MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaL_traceback

Function luaL_traceback

src/Chain/libraries/glua/lauxlib.cpp:141–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139
140
141LUALIB_API void luaL_traceback(lua_State *L, lua_State *L1,
142 const char *msg, int level) {
143 lua_Debug ar;
144 int top = lua_gettop(L);
145 int last = lastlevel(L1);
146 int n1 = (last - level > LEVELS1 + LEVELS2) ? LEVELS1 : -1;
147 if (msg)
148 lua_pushfstring(L, "%s\n", msg);
149 luaL_checkstack(L, 10, nullptr);
150 lua_pushliteral(L, "stack traceback:");
151 while (lua_getstack(L1, level++, &ar)) {
152 if (n1-- == 0) { /* too many levels? */
153 lua_pushliteral(L, "\n\t..."); /* add a '...' */
154 level = last - LEVELS2 + 1; /* and skip to last ones */
155 }
156 else {
157 lua_getinfo(L1, "Slnt", &ar);
158 lua_pushfstring(L, "\n\t%s:", ar.short_src);
159 if (ar.currentline > 0)
160 lua_pushfstring(L, "%d:", ar.currentline);
161 lua_pushliteral(L, " in ");
162 pushfuncname(L, &ar);
163 if (ar.istailcall)
164 lua_pushliteral(L, "\n\t(...tail calls...)");
165 lua_concat(L, lua_gettop(L) - top);
166 }
167 }
168 lua_concat(L, lua_gettop(L) - top);
169}
170
171/* }====================================================== */
172

Callers 5

msghandlerFunction · 0.85
db_tracebackFunction · 0.85
msghandlerFunction · 0.85
msghandlerFunction · 0.85
msghandlerFunction · 0.85

Calls 8

lua_gettopFunction · 0.85
lastlevelFunction · 0.85
lua_pushfstringFunction · 0.85
luaL_checkstackFunction · 0.85
lua_getstackFunction · 0.85
lua_getinfoFunction · 0.85
pushfuncnameFunction · 0.85
lua_concatFunction · 0.85

Tested by

no test coverage detected