Skip to content

Commit bf7787f

Browse files
Magnus PetterssonMagnus Pettersson
Magnus Pettersson
authored and
Magnus Pettersson
committed
Rewrote event handler, now working correct
1 parent 722c942 commit bf7787f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Ghost.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function ghostOnEvent()
1+
function ghostInit()
22
ChatFrame1:AddMessage( ghostText['loaded'] , 1.0, 1.0, 0.0, 1.0);
33

44
SLASH_Ghost1 = "/ghost";
@@ -131,6 +131,12 @@ function ghostSlashCommandText( param )
131131
end
132132
end
133133

134-
local f = CreateFrame("Frame")
135-
f:RegisterEvent("VARIABLES_LOADED")
136-
f:SetScript("OnEvent", ghostOnEvent)
134+
-- Register all events
135+
136+
local frame = CreateFrame("Frame")
137+
frame:RegisterEvent("VARIABLES_LOADED")
138+
frame:SetScript("OnEvent", function()
139+
if event == "VARIABLES_LOADED" then
140+
ghostInit();
141+
end
142+
end)

0 commit comments

Comments
 (0)