|
@@ -94,14 +94,14 @@ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
|
|
|
|
|
|
|
|
|
static void pushfuncname (lua_State *L, lua_Debug *ar) {
|
|
|
- if (pushglobalfuncname(L, ar)) { /* try first a global name */
|
|
|
- lua_pushfstring(L, "function '%s'", lua_tostring(L, -1));
|
|
|
- lua_remove(L, -2); /* remove name */
|
|
|
- }
|
|
|
- else if (*ar->namewhat != '\0') /* is there a name from code? */
|
|
|
+ if (*ar->namewhat != '\0') /* is there a name from code? */
|
|
|
lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */
|
|
|
else if (*ar->what == 'm') /* main? */
|
|
|
lua_pushliteral(L, "main chunk");
|
|
|
+ else if (pushglobalfuncname(L, ar)) { /* try a global name */
|
|
|
+ lua_pushfstring(L, "function '%s'", lua_tostring(L, -1));
|
|
|
+ lua_remove(L, -2); /* remove name */
|
|
|
+ }
|
|
|
else if (*ar->what != 'C') /* for Lua functions, use <file:line> */
|
|
|
lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
|
|
|
else /* nothing left... */
|