refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-05 08:07:40 +02:00
parent ff4ce0d288
commit 9576b9fe31
5 changed files with 15 additions and 33 deletions
+5 -5
View File
@@ -39,15 +39,15 @@ end
ADDON_LOADED = t
do
local handlers, handlers2 = t, t
function public.LOAD.set(f) tinsert(handlers, f) end
function public.LOAD2.set(f) tinsert(handlers2, f) end
function public.LOAD.set(f) handlers[f] = true end
function public.LOAD2.set(f) handlers2[f] = true end
event_frame:SetScript('OnEvent', function()
if event == 'ADDON_LOADED' then
if ADDON_LOADED[arg1] then ADDON_LOADED[arg1]() end
(ADDON_LOADED[arg1] or nop)()
elseif event == 'VARIABLES_LOADED' then
for _, f in handlers do f() end
for f in handlers do f() end
elseif event == 'PLAYER_LOGIN' then
for _, f in handlers2 do f() end
for f in handlers2 do f() end
print('v' .. version .. ' loaded.')
else
M[event]()