add prefix check to events.on
This commit is contained in:
parent
31d2dde534
commit
60ed10c0a1
@ -2,7 +2,14 @@ local events = {
|
||||
handlers = {}
|
||||
}
|
||||
|
||||
local __parse_path = parse_path
|
||||
local __pack_is_installed = pack.is_installed
|
||||
|
||||
function events.on(event, func)
|
||||
local prefix = __parse_path(event)
|
||||
if prefix ~= "core" and not __pack_is_installed(prefix) then
|
||||
error("pack prefix required")
|
||||
end
|
||||
if events.handlers[event] == nil then
|
||||
events.handlers[event] = {}
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user