|
You need to write:
lua_getglobal(L, "debug");
lua_getfield(L, -1, "traceback");
lua_replace(L, -2);
lua_getglobal (L, "program01");
int rv = lua_pcall(L, 0, 0, -2);
if (rv) { /* ... */; lua_pop(L, 1); /* remove error from the stack */ }
lua_pop(L, 1); /* remove debug.traceback from the stack */