Hello guys. I would like download image from server and then set it as texture of sprite. Download image from server is pretty easy, here is part of code:
http.request(url, "GET", function(self, id, res)
if res.status ~= 200 and res.status ~= 304 then
print("Unable to get image", res.response)
return
end
local img = image.load(res.response)
if not img then
print("Unable to load image")
return
end
The problem is that i do not know what to do next. I have tried something like this:
resource.set_texture( go.get("#sprite", "texture0"), some header, img.buffer )
but img.buffer is in string format. So my question is that is there some easy workaround to download image from server and set it as texture of sprite?
Thanks