MCPcopy Create free account
hub / github.com/DFHack/dfhack / pushfuncname

Function pushfuncname

depends/lua/src/lauxlib.c:94–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94static void pushfuncname (lua_State *L, lua_Debug *ar) {
95 if (pushglobalfuncname(L, ar)) { /* try first a global name */
96 lua_pushfstring(L, "function '%s'", lua_tostring(L, -1));
97 lua_remove(L, -2); /* remove name */
98 }
99 else if (*ar->namewhat != '\0') /* is there a name from code? */
100 lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */
101 else if (*ar->what == 'm') /* main? */
102 lua_pushliteral(L, "main chunk");
103 else if (*ar->what != 'C') /* for Lua functions, use <file:line> */
104 lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
105 else /* nothing left... */
106 lua_pushliteral(L, "?");
107}
108
109
110static int lastlevel (lua_State *L) {

Callers 1

luaL_tracebackFunction · 0.85

Calls 2

pushglobalfuncnameFunction · 0.85
lua_pushfstringFunction · 0.85

Tested by

no test coverage detected