MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / pushfuncname

Function pushfuncname

lib/lua/src/lauxlib.c:101–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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