This commit is contained in:
Sven Van de Velde
2016-12-11 11:01:06 +01:00
parent 46aa9ddf65
commit 24a6d37500
18 changed files with 136 additions and 146 deletions

View File

@@ -87,16 +87,13 @@ function EVENT:Init( EventID, EventClass )
self:F3( { _EVENTCODES[EventID], EventClass } )
if not self.Events[EventID] then
self.Events[EventID] = {}
-- Create a WEAK table to ensure that the garbage collector is cleaning the event links when the object usage is cleaned.
local Meta = {}
setmetatable( self.Events[EventID], Meta )
Meta.__mode = "k"
self.Events[EventID] = setmetatable( {}, { __mode = "k" } )
end
if not self.Events[EventID][EventClass] then
self.Events[EventID][EventClass] = {}
self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "v" } )
end
return self.Events[EventID][EventClass]
end