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

Function TArray_New

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

Source from the content-addressed store, hash-verified

27}
28
29static int32 TArray_New(lua_State* L)
30{
31 int32 NumParams = lua_gettop(L);
32 if (NumParams != 2)
33 return luaL_error(L, "invalid parameters");
34
35 auto& Env = UnLua::FLuaEnv::FindEnvChecked(L);
36 auto ElementType = Env.GetPropertyRegistry()->CreateTypeInterface(L, 2);
37 if (!ElementType)
38 return luaL_error(L, "failed to create TArray");
39
40 auto Registry = UnLua::FLuaEnv::FindEnvChecked(L).GetContainerRegistry();
41 Registry->NewArray(L, ElementType, FLuaArray::OwnedBySelf);
42 return 1;
43}
44
45static int TArray_Enumerable(lua_State* L)
46{

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
CreateTypeInterfaceMethod · 0.80
NewArrayMethod · 0.80

Tested by

no test coverage detected