lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've looked at the manual reference [1], but I don't really understand what it means. I'm having an occasional lua panic, which seems to be related to the creation and or collection of coroutines created from C (lua_newthread), but I'm not sure. The error message I get from a custom panic handler is 'table index is nil', but no traceback or any other info as to when it happens.

So, in an attempt to figure it out, I'd like to know - what kinds of things should I be looking at? Any calls in particular to be wary of? Rawset?


[1] lua_atpanic
lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
Sets a new panic function and returns the old one.

If an error happens outside any protected environment, Lua calls a panic function and then calls exit(EXIT_FAILURE), thus exiting the host application. Your panic function may avoid this exit by never returning (e.g., doing a long jump).

The panic function can access the error message at the top of the stack.