lua-users home
lua-l archive

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


To answer my own question (and to go back to what some others 
suggested, i.e. read lua.c):

  int base = lua_gettop(L) - narg;  /* function index */
  lua_pushliteral(L, "_TRACEBACK");
  lua_rawget(L, LUA_GLOBALSINDEX);  /* get traceback function */
  lua_insert(L, base);  /* put it under chunk and args */

The above makes it a lot more clear what I should be trying to do, 
since it handles what I was worried about (i.e. mangling existing 
functions) by sneaking stuff underneath the current frame.

It seems to me that it would be simpler to set a global error handling 
function than to specify it for every call to lua_pcall?

Brian