I'm porting my code from 4.2 to 5.0 and I can't understand the new
error managment. Could anyone explain it? in the documentation it's
not very clear:
- Where is the error message I send with "lua_error()"?
- Where I can get it after the error? maybe in "lua_atpanic()"?
Thanks you all!
> - Where is the error message I send with "lua_error()"?
You call lua_error with your own error when your code that is called
by lua detects an error of some sort.
> - Where I can get it after the error? maybe in "lua_atpanic()"?
The way I see it the routine called by lua_atpanic is used as a last
resort. If you use lua_pcall() or similar or have your own functions
that load Lua code then you get the error message at the top
of the stack and a error return code when a error occurs (including
lua_error being called). There of examples of this in the auxlib I
This is another reason (IMHO) that Lua 5.0 is much cleaner in its
interface than Lua 4.0.