* @see FLuaMap::Find(...). Return a reference for the value */
| 199 | * @see FLuaMap::Find(...). Return a reference for the value |
| 200 | */ |
| 201 | static int32 TMap_FindRef(lua_State* L) |
| 202 | { |
| 203 | int32 NumParams = lua_gettop(L); |
| 204 | if (NumParams != 2) |
| 205 | return luaL_error(L, "invalid parameters"); |
| 206 | |
| 207 | FLuaMap* Map = (FLuaMap*)(GetCppInstanceFast(L, 1)); |
| 208 | TMap_Guard(L, Map); |
| 209 | |
| 210 | Map->KeyInterface->Initialize(Map->ElementCache); |
| 211 | Map->KeyInterface->Write(L, Map->ElementCache, 2); |
| 212 | void* Value = Map->Find(Map->ElementCache); |
| 213 | if (Value) |
| 214 | { |
| 215 | const void* Key = (uint8*)Value - Map->ValueInterface->GetOffset(); |
| 216 | Map->ValueInterface->Read(L, Key, false); |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | lua_pushnil(L); |
| 221 | } |
| 222 | Map->KeyInterface->Destruct(Map->ElementCache); |
| 223 | return 1; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * @see FLuaMap::Clear(...) |
nothing calls this directly
no test coverage detected