MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaL_traceback

Function luaL_traceback

freebsd/contrib/openzfs/module/lua/lauxlib.c:110–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

zcp_error_handlerFunction · 0.85

Calls 7

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

Tested by

no test coverage detected