| 81 | |
| 82 | |
| 83 | static void pushfuncname (lua_State *L, lua_Debug *ar) { |
| 84 | if (*ar->namewhat != '\0') /* is there a name? */ |
| 85 | lua_pushfstring(L, "function " LUA_QS, ar->name); |
| 86 | else if (*ar->what == 'm') /* main? */ |
| 87 | lua_pushliteral(L, "main chunk"); |
| 88 | else if (*ar->what == 'C') { |
| 89 | if (pushglobalfuncname(L, ar)) { |
| 90 | lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1)); |
| 91 | lua_remove(L, -2); /* remove name */ |
| 92 | } |
| 93 | else |
| 94 | lua_pushliteral(L, "?"); |
| 95 | } |
| 96 | else |
| 97 | lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | static int countlevels (lua_State *L) { |
no test coverage detected