MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaL_traceback

Function luaL_traceback

extlibs/sol3/include/sol/sol.hpp:2759–2783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2757#define COMPAT53_LEVELS2 10 /* size of the second part of the stack */
2758
2759COMPAT53_API void luaL_traceback(lua_State *L, lua_State *L1,
2760 const char *msg, int level) {
2761 lua_Debug ar;
2762 int top = lua_gettop(L);
2763 int numlevels = compat53_countlevels(L1);
2764 int mark = (numlevels > COMPAT53_LEVELS1 + COMPAT53_LEVELS2) ? COMPAT53_LEVELS1 : 0;
2765 if (msg) lua_pushfstring(L, "%s\n", msg);
2766 lua_pushliteral(L, "stack traceback:");
2767 while (lua_getstack(L1, level++, &ar)) {
2768 if (level == mark) { /* too many levels? */
2769 lua_pushliteral(L, "\n\t..."); /* add a '...' */
2770 level = numlevels - COMPAT53_LEVELS2; /* and skip to last ones */
2771 }
2772 else {
2773 lua_getinfo(L1, "Slnt", &ar);
2774 lua_pushfstring(L, "\n\t%s:", ar.short_src);
2775 if (ar.currentline > 0)
2776 lua_pushfstring(L, "%d:", ar.currentline);
2777 lua_pushliteral(L, " in ");
2778 compat53_pushfuncname(L, &ar);
2779 lua_concat(L, lua_gettop(L) - top);
2780 }
2781 }
2782 lua_concat(L, lua_gettop(L) - top);
2783}
2784
2785COMPAT53_API int luaL_fileresult(lua_State *L, int stat, const char *fname) {
2786 const char *serr = NULL;

Callers 1

Calls 7

lua_gettopFunction · 0.85
compat53_countlevelsFunction · 0.85
lua_pushfstringFunction · 0.85
lua_getstackFunction · 0.85
lua_getinfoFunction · 0.85
compat53_pushfuncnameFunction · 0.85
lua_concatFunction · 0.85

Tested by

no test coverage detected