-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathevent.lua
More file actions
29 lines (24 loc) · 586 Bytes
/
Copy pathevent.lua
File metadata and controls
29 lines (24 loc) · 586 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local ADDONNAME, ADDONSELF = ...
local f = CreateFrame("Frame")
local m = {}
f:SetScript("OnEvent", function(self, event, ...)
if event == "ADDON_LOADED" then
local name = select(1, ...)
if ADDONNAME ~= name then
return
end
end
local cbs = m[event]
if cbs then
for _, cb in pairs(cbs) do
cb(...)
end
end
end)
ADDONSELF.regevent = function(event, cb)
if not m[event] then
m[event] = {}
end
f:RegisterEvent(event)
table.insert(m[event] , cb)
end