MCPcopy Create free account
hub / github.com/Tencent/UnLua / TMap_New

Function TMap_New

Plugins/UnLua/Source/UnLua/Private/BaseLib/LuaLib_Map.cpp:32–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32static int32 TMap_New(lua_State* L)
33{
34 int32 NumParams = lua_gettop(L);
35 if (NumParams != 3)
36 return luaL_error(L, "invalid parameters");
37
38 auto& Env = UnLua::FLuaEnv::FindEnvChecked(L);
39 auto KeyType = Env.GetPropertyRegistry()->CreateTypeInterface(L, 2);
40 if (!KeyType)
41 return luaL_error(L, "invalid key type");
42
43 auto ValueType = Env.GetPropertyRegistry()->CreateTypeInterface(L, 3);
44 if (!ValueType)
45 return luaL_error(L, "invalid value type");
46
47 auto Registry = Env.GetContainerRegistry();
48 Registry->NewMap(L, KeyType, ValueType, FLuaMap::OwnedBySelf);
49
50 return 1;
51}
52
53static int TMap_Enumerable(lua_State* L)
54{

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
CreateTypeInterfaceMethod · 0.80
NewMapMethod · 0.80

Tested by

no test coverage detected