mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Optimize table usage in methods
This commit is contained in:
@@ -1201,15 +1201,14 @@ namespace LuaUnit
|
||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||
list.remove_if(guidCheck);
|
||||
|
||||
lua_newtable(L);
|
||||
lua_createtable(L, list.size(), 0);
|
||||
int tbl = lua_gettop(L);
|
||||
uint32 i = 0;
|
||||
|
||||
for (std::list<Unit*>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
Eluna::Push(L, ++i);
|
||||
Eluna::Push(L, *it);
|
||||
lua_settable(L, tbl);
|
||||
lua_rawseti(L, tbl, ++i);
|
||||
}
|
||||
|
||||
lua_settop(L, tbl);
|
||||
@@ -1239,15 +1238,14 @@ namespace LuaUnit
|
||||
ElunaUtil::ObjectGUIDCheck guidCheck(unit->GET_GUID());
|
||||
list.remove_if(guidCheck);
|
||||
|
||||
lua_newtable(L);
|
||||
lua_createtable(L, list.size(), 0);
|
||||
int tbl = lua_gettop(L);
|
||||
uint32 i = 0;
|
||||
|
||||
for (std::list<Unit*>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
Eluna::Push(L, ++i);
|
||||
Eluna::Push(L, *it);
|
||||
lua_settable(L, tbl);
|
||||
lua_rawseti(L, tbl, ++i);
|
||||
}
|
||||
|
||||
lua_settop(L, tbl);
|
||||
|
||||
Reference in New Issue
Block a user