Load an image from inside a zip (inside the .love)?
Posted: Sun Feb 19, 2012 10:20 pm
I'm working on a custom animated sprite format that involves several PNGs zipped up with a control file. I can't seem to open the image however. love.graphics.newImage has a version that takes a file handle, but it refuses to take it from LuaZip. I get the following error:
animatedSprite.lua
While it doesn't seem to be a standard file handle, it supports :read(), :seek(), :lines(), and :close() methods. Is there another method I can accomplish this, or should I rework the format to not use a zip file?
Code: Select all
Error: [string "loaders/animatedSprite.lua"]:18: Incorrect parameter type: expected ImageData
stack traceback:
[C]: in function 'newImage'
[string "loaders/animatedSprite.lua"]:18: in function 'addImage'
[string "loaders/animatedSprite.lua"]:45: in function 'fromFile'
[string "main.lua"]:13: in function 'load'
[string "boot.lua"]:310: in function <[string "boot.lua"]:308>
[C]: in function 'xpcall'
While it doesn't seem to be a standard file handle, it supports :read(), :seek(), :lines(), and :close() methods. Is there another method I can accomplish this, or should I rework the format to not use a zip file?