| 2699 | } |
| 2700 | |
| 2701 | static int compat53_findfield(lua_State *L, int objidx, int level) { |
| 2702 | if (level == 0 || !lua_istable(L, -1)) |
| 2703 | return 0; /* not found */ |
| 2704 | lua_pushnil(L); /* start 'next' loop */ |
| 2705 | while (lua_next(L, -2)) { /* for each pair in table */ |
| 2706 | if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ |
| 2707 | if (lua_rawequal(L, objidx, -1)) { /* found object? */ |
| 2708 | lua_pop(L, 1); /* remove value (but keep name) */ |
| 2709 | return 1; |
| 2710 | } |
| 2711 | else if (compat53_findfield(L, objidx, level - 1)) { /* try recursively */ |
| 2712 | lua_remove(L, -2); /* remove table (but keep name) */ |
| 2713 | lua_pushliteral(L, "."); |
| 2714 | lua_insert(L, -2); /* place '.' between the two names */ |
| 2715 | lua_concat(L, 3); |
| 2716 | return 1; |
| 2717 | } |
| 2718 | } |
| 2719 | lua_pop(L, 1); /* remove value */ |
| 2720 | } |
| 2721 | return 0; /* not found */ |
| 2722 | } |
| 2723 | |
| 2724 | static int compat53_pushglobalfuncname(lua_State *L, lua_Debug *ar) { |
| 2725 | int top = lua_gettop(L); |
no test coverage detected