mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Fix inefficient InvalidateObjects
This commit is contained in:
@@ -232,14 +232,6 @@ void Eluna::OpenLua()
|
||||
// Register methods and functions
|
||||
RegisterFunctions(this);
|
||||
|
||||
// Create hidden table with weak values
|
||||
lua_newtable(L);
|
||||
lua_newtable(L);
|
||||
lua_pushstring(L, "v");
|
||||
lua_setfield(L, -2, "__mode");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, ELUNA_OBJECT_STORE);
|
||||
|
||||
// Set lua require folder paths (scripts folder structure)
|
||||
lua_getglobal(L, "package");
|
||||
lua_pushstring(L, lua_requirepath.c_str());
|
||||
@@ -526,18 +518,8 @@ void Eluna::RunScripts()
|
||||
|
||||
void Eluna::InvalidateObjects()
|
||||
{
|
||||
lua_pushstring(L, ELUNA_OBJECT_STORE);
|
||||
lua_rawget(L, LUA_REGISTRYINDEX);
|
||||
ASSERT(lua_istable(L, -1));
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2))
|
||||
{
|
||||
if (ElunaObject* elunaObj = CHECKOBJ<ElunaObject>(L, -1, false))
|
||||
elunaObj->Invalidate();
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
++callstackid;
|
||||
ASSERT(callstackid, "Callstackid overflow");
|
||||
}
|
||||
|
||||
void Eluna::Report(lua_State* _L)
|
||||
|
||||
Reference in New Issue
Block a user