I'm embedding a Lua interpreter in my current project (written in C) and I am looking for an example of how to handle errors. This is what I have so far...
if(0 != setjmp(jmpbuffer)) /* Where does this buffer come from ? */
{
printf("Aargh an error!\n");
return;
}
lua_getfield(L, LUA_GLOBALSINDEX, "myfunction");
lua_call(L, 0, 0);
printf("Lua code ran OK.\n");
The manual just says that errors are thrown using the longjmp function but longjmp needs a buffer. Do I have to supply that or does Lua allocate a buffer? The manual is a bit vague on this.