Author Topic: Downloading files with EGSL  (Read 2287 times)

Tomaaz

  • Guest
Downloading files with EGSL
« on: June 11, 2013, 01:42:49 AM »
It's possible to use Luasocket with EGSL. This simple example downloads a couple of screenshots from EGSL website.

Code: [Select]
local http = require("socket.http")

adresy = {"http://www.egsl.retrogamecoding.org//media/wallman/wallman.png", "http://www.egsl.retrogamecoding.org//media/wallman/wallman1.png", "http://www.egsl.retrogamecoding.org//media/santa/santa1.png", "http://www.egsl.retrogamecoding.org//media/santa/santa2.png", "http://www.egsl.retrogamecoding.org//media/brickmaster4.png"}

for x, y in ipairs(adresy) do
io.write("Downloading file ", x, "... ")
plik = io.open(tostring(x)..".png", "wb")
http.request{
    url = y,
    sink = ltn12.sink.file(plik)
}
print("Done!")
end
« Last Edit: June 11, 2013, 01:48:25 AM by Tomaaz »

lelldorin

  • Guest
Re: Downloading files with EGSL
« Reply #1 on: June 20, 2013, 07:12:54 PM »
there i can get socket.http ?

Tomaaz

  • Guest
Re: Downloading files with EGSL
« Reply #2 on: June 20, 2013, 09:00:26 PM »
It is part of Luasocket.