Images from the Web
Posted: Wed Apr 20, 2016 6:22 pm
Is it possible, using something like lua socket or something like that, to get and use images from the web in a love project?
Thanks!
Thanks!
Yes. You can use luasocket's http.request and love.image.newImageData to do so.MicroMacro wrote:Is it possible, using something like lua socket or something like that, to get and use images from the web in a love project?
Thanks!
Code: Select all
local http = require "socket.http"
local logo
function love.load()
logo = http.request("http://love2d.org/style/logo.png")
logo = love.filesystem.newFileData(logo, "logo.png")
logo = love.graphics.newImage(logo)
end
function love.draw()
love.graphics.draw(logo)
end