| 80 | } |
| 81 | |
| 82 | void GetFunctionNames(lua_State* L, const int TableRef, TSet<FName>& FunctionNames) |
| 83 | { |
| 84 | const auto Type = lua_rawgeti(L, LUA_REGISTRYINDEX, TableRef); |
| 85 | if (Type == LUA_TNIL) |
| 86 | return; |
| 87 | |
| 88 | static auto GetFunctionName = [](lua_State* L, void* Userdata) |
| 89 | { |
| 90 | const auto ValueType = lua_type(L, -1); |
| 91 | if (ValueType != LUA_TFUNCTION) |
| 92 | return true; |
| 93 | |
| 94 | auto Names = (TSet<FName>*)Userdata; |
| 95 | #if SUPPORTS_RPC_CALL |
| 96 | FString FuncName(lua_tostring(L, -2)); |
| 97 | if (FuncName.EndsWith(TEXT("_RPC"))) |
| 98 | FuncName = FuncName.Left(FuncName.Len() - 4); |
| 99 | Names->Add(FName(*FuncName)); |
| 100 | #else |
| 101 | Names->Add(FName(lua_tostring(L, -2))); |
| 102 | #endif |
| 103 | |
| 104 | return true; |
| 105 | }; |
| 106 | |
| 107 | auto N = 1; |
| 108 | bool bNext; |
| 109 | do |
| 110 | { |
| 111 | bNext = TraverseTable(L, -1, &FunctionNames, GetFunctionName) > INDEX_NONE; |
| 112 | if (bNext) |
| 113 | { |
| 114 | lua_pushstring(L, "Super"); |
| 115 | lua_rawget(L, -2); |
| 116 | ++N; |
| 117 | bNext = lua_istable(L, -1); |
| 118 | } |
| 119 | } while (bNext); |
| 120 | lua_pop(L, N); |
| 121 | } |
| 122 | |
| 123 | int GetLoadedModule(lua_State* L, const char* ModuleName) |
| 124 | { |
no test coverage detected