This is my code to load the file that I found online and tried to use for my project:
function LoadSprite (aSpritePath, aObjectName)
local file = assert(io.open(aSpritePath, "r"))
local filedata, err = love.filesystem.newFileData(file:read("*all"), aObjectName .. ".png")
file:close()
local image
if (err == nil) then
local imageData = love.image.newImageData(filedata)
image = love.graphics.newImage(imageData)
end
return image
end
I get this error: Could not decode file '<myImageName>.png' to ImageData: unsupported file format.
I've tried to search online, but I can't really find much about this.
Would be awesome if anyone could help me
