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

Function TSet_New

Plugins/UnLua/Source/UnLua/Private/BaseLib/LuaLib_Set.cpp:28–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28static int32 TSet_New(lua_State* L)
29{
30 int32 NumParams = lua_gettop(L);
31 if (NumParams != 2)
32 return luaL_error(L, "invalid parameters");
33
34 auto& Env = UnLua::FLuaEnv::FindEnvChecked(L);
35 auto ElementType = Env.GetPropertyRegistry()->CreateTypeInterface(L, 2);
36 if (!ElementType)
37 return luaL_error(L, "invalid element type");
38
39 auto Registry = UnLua::FLuaEnv::FindEnvChecked(L).GetContainerRegistry();
40 Registry->NewSet(L, ElementType, FLuaSet::OwnedBySelf);
41
42 return 1;
43}
44
45/**
46 * @see FLuaSet::Num(...)

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
CreateTypeInterfaceMethod · 0.80
NewSetMethod · 0.80

Tested by

no test coverage detected