MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaL_traceback

Function luaL_traceback

ThirdParty/lua/lua/lauxlib.c:125–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

db_tracebackFunction · 0.85

Calls 7

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

Tested by

no test coverage detected