LOVEDownloader = require('LOVEDownloader')
function love.load()
file = LOVEDownloader.download("http://www.randomnumber.org/randdata/1MB_200409232104.dat", "file.dat", {
update = function(per, down, size)
print(per, down, size)
end
})
file:start() -- Start download
end
function love.update()
file:update()
end
function love.draw()
love.graphics.print(math.floor(file.progress*100) .. "%", 10, 10)
if file.success then
print("success")
end
end
MPQC wrote:Can't check the source now, but curious. Does it download the file to the love save path, or its current directory?
It uses love.filesystem, so it downloads to the loves save directory. But if you want to download to another directory, you can replace love.filesystem.newFile() with io.open() in thread.lua
Ah, cool! I already have my HTTP connections threaded, but I'll check out your modification because that sounds like something I could use. I'll have approximately 200,000 512x512 images in my game and something tells me people won't want those all at once
Very nice! I can see this being very useful in the future. Maybe this could be used when making a game with someone that doesn't live anywhere close to you.