Exemple #1
0
 static int traceback(Lua.LuaState L)
 {
     if (Lua.lua_isstring(L, 1) == 0) /* 'message' not a string? */
     {
         return(1);                   /* keep it intact */
     }
     Lua.lua_getfield(L, Lua.LUA_GLOBALSINDEX, "debug");
     if (!Lua.lua_istable(L, -1))
     {
         Lua.lua_pop(L, 1);
         return(1);
     }
     Lua.lua_getfield(L, -1, "traceback");
     if (!Lua.lua_isfunction(L, -1))
     {
         Lua.lua_pop(L, 2);
         return(1);
     }
     Lua.lua_pushvalue(L, 1);   /* pass error message */
     Lua.lua_pushinteger(L, 2); /* skip this function and traceback */
     Lua.lua_call(L, 2, 1);     /* call debug.traceback */
     return(1);
 }