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

Function TArray_Insert

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

* @see FLuaArray::Insert(...) */

Source from the content-addressed store, hash-verified

175 * @see FLuaArray::Insert(...)
176 */
177static int32 TArray_Insert(lua_State* L)
178{
179 int32 NumParams = lua_gettop(L);
180 if (NumParams != 3)
181 return luaL_error(L, "invalid parameters");
182
183 FLuaArray* Array = (FLuaArray*)(GetCppInstanceFast(L, 1));
184 TArray_Guard(L, Array);
185
186 Array->Inner->Initialize(Array->ElementCache);
187 Array->Inner->Write(L, Array->ElementCache, 2);
188 int32 Index = lua_tointeger(L, 3);
189 --Index;
190 Array->Insert(Array->ElementCache, Index);
191 Array->Inner->Destruct(Array->ElementCache);
192 return 0;
193}
194
195/**
196 * @see FLuaArray::Remove(...)

Callers

nothing calls this directly

Calls 8

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
GetCppInstanceFastFunction · 0.85
TArray_GuardFunction · 0.85
InsertMethod · 0.80
InitializeMethod · 0.45
WriteMethod · 0.45
DestructMethod · 0.45

Tested by

no test coverage detected