double event handlers calls fix
This commit is contained in:
@@ -135,6 +135,18 @@ function events.on(event, func)
|
||||
table.insert(events.handlers[event], func)
|
||||
end
|
||||
|
||||
function events.remove_by_prefix(prefix)
|
||||
for name, handlers in pairs(events.handlers) do
|
||||
if name:sub(1, #prefix) == prefix then
|
||||
events.handlers[name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function pack.unload(prefix)
|
||||
events.remove_by_prefix(prefix)
|
||||
end
|
||||
|
||||
function events.emit(event, ...)
|
||||
result = nil
|
||||
if events.handlers[event] then
|
||||
|
||||
Reference in New Issue
Block a user