| 98 | |
| 99 | |
| 100 | static 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 | |
| 116 | static int lastlevel (lua_State *L) { |
no test coverage detected