MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_traceback

Function luaL_traceback

third-party/lua-5.2.4/src/lauxlib.c:116–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115
116LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,
117 const char *msg, int level) {
118 lua_Debug ar;
119 int top = lua_gettop(L);
120 int numlevels = countlevels(L1);
121 int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;
122 if (msg) lua_pushfstring(L, "%s\n", msg);
123 lua_pushliteral(L, "stack traceback:");
124 while (lua_getstack(L1, level++, &ar)) {
125 if (level == mark) { /* too many levels? */
126 lua_pushliteral(L, "\n\t..."); /* add a '...' */
127 level = numlevels - LEVELS2; /* and skip to last ones */
128 }
129 else {
130 lua_getinfo(L1, "Slnt", &ar);
131 lua_pushfstring(L, "\n\t%s:", ar.short_src);
132 if (ar.currentline > 0)
133 lua_pushfstring(L, "%d:", ar.currentline);
134 lua_pushliteral(L, " in ");
135 pushfuncname(L, &ar);
136 if (ar.istailcall)
137 lua_pushliteral(L, "\n\t(...tail calls...)");
138 lua_concat(L, lua_gettop(L) - top);
139 }
140 }
141 lua_concat(L, lua_gettop(L) - top);
142}
143
144/* }====================================================== */
145

Callers 2

tracebackFunction · 0.70
db_tracebackFunction · 0.70

Calls 7

countlevelsFunction · 0.85
lua_gettopFunction · 0.70
lua_pushfstringFunction · 0.70
lua_getstackFunction · 0.70
lua_getinfoFunction · 0.70
pushfuncnameFunction · 0.70
lua_concatFunction · 0.70

Tested by

no test coverage detected