mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add events.reset
This commit is contained in:
parent
ac6084f904
commit
e762cf9b23
4 changed files with 22 additions and 1 deletions
|
|
@ -23,6 +23,14 @@ function events.on(event, func)
|
|||
table.insert(events.handlers[event], func)
|
||||
end
|
||||
|
||||
function events.reset(event, func)
|
||||
if func == nil then
|
||||
events.handlers[event] = nil
|
||||
else
|
||||
events.handlers[event] = {func}
|
||||
end
|
||||
end
|
||||
|
||||
function events.remove_by_prefix(prefix)
|
||||
for name, handlers in pairs(events.handlers) do
|
||||
local actualname = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue