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

Function TArray_Reserve

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

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

Source from the content-addressed store, hash-verified

250 * @see FLuaArray::Reserve(...)
251 */
252static int32 TArray_Reserve(lua_State* L)
253{
254 int32 NumParams = lua_gettop(L);
255 if (NumParams != 2)
256 return luaL_error(L, "invalid parameters");
257
258 FLuaArray* Array = (FLuaArray*)(GetCppInstanceFast(L, 1));
259 TArray_Guard(L, Array);
260
261 int32 Size = lua_tointeger(L, 2);
262 bool bSuccess = Array->Reserve(Size);
263 if (!bSuccess)
264 {
265 UE_LOG(LogUnLua, Warning, TEXT("%s: 'Reserve' is only valid for empty TArray!"), ANSI_TO_TCHAR(__FUNCTION__));
266 }
267 lua_pushboolean(L, bSuccess);
268 return 1;
269}
270
271/**
272 * @see FLuaArray::Resize(...)

Callers

nothing calls this directly

Calls 6

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
GetCppInstanceFastFunction · 0.85
TArray_GuardFunction · 0.85
lua_pushbooleanFunction · 0.85
ReserveMethod · 0.45

Tested by

no test coverage detected