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

Function TArray_Set

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

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

Source from the content-addressed store, hash-verified

358 * @see FLuaArray::Set(...)
359 */
360static int32 TArray_Set(lua_State* L)
361{
362 int32 NumParams = lua_gettop(L);
363 if (NumParams != 3)
364 return luaL_error(L, "invalid parameters");
365
366 FLuaArray* Array = (FLuaArray*)(GetCppInstanceFast(L, 1));
367 TArray_Guard(L, Array);
368
369 int32 Index = lua_tointeger(L, 2);
370 --Index;
371 if (!Array->IsValidIndex(Index))
372 {
373 UNLUA_LOGERROR(L, LogUnLua, Log, TEXT("%s: TArray Invalid Index!"), ANSI_TO_TCHAR(__FUNCTION__));
374 return 0;
375 }
376
377 Array->Inner->Initialize(Array->ElementCache);
378 Array->Inner->Write(L, Array->ElementCache, 3);
379 Array->Set(Index, Array->ElementCache);
380 Array->Inner->Destruct(Array->ElementCache);
381 return 0;
382}
383
384/**
385 * @see FLuaArray::Swap(...)

Callers 1

TArray_NewIndexFunction · 0.85

Calls 9

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
GetCppInstanceFastFunction · 0.85
TArray_GuardFunction · 0.85
IsValidIndexMethod · 0.45
InitializeMethod · 0.45
WriteMethod · 0.45
SetMethod · 0.45
DestructMethod · 0.45

Tested by

no test coverage detected