MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / StackTraceback

Function StackTraceback

LuaSTGPlus/AppFrame.cpp:1208–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1206
1207#pragma region 框架函数
1208static int StackTraceback(lua_State *L)
1209{
1210 lua_getfield(L, LUA_GLOBALSINDEX, "debug"); // errmsg t
1211 if (!lua_istable(L, -1))
1212 {
1213 lua_pop(L, 1);
1214 return 1;
1215 }
1216 lua_getfield(L, -1, "traceback"); // errmsg t f
1217 if (!lua_isfunction(L, -1) && !lua_iscfunction(L, -1))
1218 {
1219 lua_pop(L, 2);
1220 return 1;
1221 }
1222 lua_pushvalue(L, 1); // errmsg t f errmsg
1223 lua_pushinteger(L, 2); // errmsg t f errmsg 2
1224 if (0 != lua_pcall(L, 2, 1, 0)) // errmsg t
1225 {
1226 LWARNING("执行stacktrace时发生错误。(%m)", lua_tostring(L, -1));
1227 lua_pop(L, 2);
1228 }
1229 return 1;
1230}
1231
1232bool AppFrame::Init()LNOEXCEPT
1233{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected