Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
385 stars 74 forks source link

image.load function couldn't loade PNG with with pixelformat = PNG #43

Closed MadPie closed 8 years ago

MadPie commented 8 years ago

Debugging session started in '/opt/zbstudio/myprograms/'. ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:19: Couldn't open Lua-SDL2.png stack traceback: [C]: in function 'error' ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:19: in local 'trySDL' ...e/warpspeedscp/luasdl2/tutorials/04-drawing/tutorial.lua:48: in main chunk Debugging session completed (traced 26 instructions). Program completed in 40.08 seconds (pid: 2418).

I was testing SDL2 after installation, and this is what happened. It ran into a problem when image.load() was called. Any ideas on why this is happening

Tangent128 commented 8 years ago

Was .../tutorials/04-drawing/ your current directory when you ran that script?

The relevant line:

local img = trySDL(image.load, "Lua-SDL2.png")

Tries to find Lua-SDL2.png in the current directory; it does not guess where the script folder is.


In other words, you should be running:

04-drawing$ lua tutorial.lua

And not:

luasdl2$ lua tutorials/04-drawing/tutorial.lua
Tangent128 commented 8 years ago

Have you gotten things working?

MadPie commented 8 years ago

Actually, luasdl2 worked fine on my laptop. The error only happened on my other machine, and I guess it is just a distro inconsistency. Thank you for the help.