function love.load()
love.filesystem.setIdentity("screenshot")
end
function love.draw()
took = true
screenshot = love.graphics.newScreenshot()
if took then
took = false
imageData = screenshot:encode( "png" )
love.filesystem.write( "ss.png", imageData, 500 )
end
end
Why does imageData = screenshot:encode( "png" ) return nil? What am I doing wrong here?
Thanks.
There is a story of a farmer whose horse ran away. That evening the neighbors gathered to commiserate with him since this was such bad luck.
He said, "May be." Continued...
function saveScreenshot()
local name = string.format("screenshot-%s.png", os.date("%Y%m%d-%H%M%S"))
local shot = love.graphics.newScreenshot()
shot:encode(name, "png")
end