MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / pushfuncname

Function pushfuncname

3rd/lua-5.4.3/src/lauxlib.c:100–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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