| 51 | } |
| 52 | |
| 53 | static int TMap_Enumerable(lua_State* L) |
| 54 | { |
| 55 | int32 NumParams = lua_gettop(L); |
| 56 | if (NumParams != 2) |
| 57 | return luaL_error(L, "invalid parameters"); |
| 58 | |
| 59 | FLuaMap::FLuaMapEnumerator** Enumerator = (FLuaMap::FLuaMapEnumerator**)(lua_touserdata(L, 1)); |
| 60 | if (!Enumerator || !*Enumerator) |
| 61 | return luaL_error(L, "invalid enumerator"); |
| 62 | |
| 63 | const auto Map = (*Enumerator)->LuaMap; |
| 64 | TMap_Guard(L, Map); |
| 65 | |
| 66 | while ((*Enumerator)->Index < Map->GetMaxIndex()) |
| 67 | { |
| 68 | if (!Map->IsValidIndex((*Enumerator)->Index)) |
| 69 | { |
| 70 | ++(*Enumerator)->Index; |
| 71 | } |
| 72 | else |
| 73 | { |
| 74 | Map->KeyInterface->Read(L, Map->GetData((*Enumerator)->Index), false); |
| 75 | Map->ValueInterface->Read(L, Map->GetData((*Enumerator)->Index) + Map->MapLayout.ValueOffset - Map->ValueInterface->GetOffset(), false); |
| 76 | ++(*Enumerator)->Index; |
| 77 | return 2; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | static int32 TMap_Pairs(lua_State* L) |
| 85 | { |
nothing calls this directly
no test coverage detected