* @see FLuaMap::Add(...) */
| 126 | * @see FLuaMap::Add(...) |
| 127 | */ |
| 128 | static int32 TMap_Add(lua_State* L) |
| 129 | { |
| 130 | int32 NumParams = lua_gettop(L); |
| 131 | if (NumParams != 3) |
| 132 | return luaL_error(L, "invalid parameters"); |
| 133 | |
| 134 | FLuaMap* Map = (FLuaMap*)(GetCppInstanceFast(L, 1)); |
| 135 | TMap_Guard(L, Map); |
| 136 | |
| 137 | void* ValueCache = (uint8*)Map->ElementCache + Map->MapLayout.ValueOffset; |
| 138 | Map->KeyInterface->Initialize(Map->ElementCache); |
| 139 | Map->ValueInterface->Initialize(ValueCache); |
| 140 | Map->KeyInterface->Write(L, Map->ElementCache, 2); |
| 141 | Map->ValueInterface->Write(L, Map->ValueInterface->GetOffset() > 0 ? Map->ElementCache : ValueCache, 3); |
| 142 | Map->Add(Map->ElementCache, ValueCache); |
| 143 | Map->KeyInterface->Destruct(Map->ElementCache); |
| 144 | Map->ValueInterface->Destruct(ValueCache); |
| 145 | return 0; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * @see FLuaMap::Remove(...) |
nothing calls this directly
no test coverage detected