Error handling in Lua using longjmp
snippet in lua

Error handling in Lua using longjmp

user4011

lua_getfield(L, LUA_GLOBALSINDEX, "myfunction");

if(0 != lua_pcall(L, 0, 0, 0))
   printf("Lua error: %s\n", lua_tostring(L, -1));
else
   printf("Lua code ran OK.\n");