Thanks, but how send "hello" and "bye" from the loop in OnEvent?
Originally Posted by Fizzlemizz
The arguments (payload) part of OnEvent is the ...
It means a variable number of arguments (each event has zero to lots or arguments depending on the event received)
Lua Code:
Frame:SetScript("OnEvent", function(self, event, ...) local arg1, arg2, arg3 = ... print(arg1, arg3) end)
You can see for the PLAYER_ENTERING_WORLD event, it contains two arguments in its payload, isInitalLogin and isReloadUI so you could:
Lua Code:
Frame:SetScript("OnEvent", function(self, event, ...) if event == "PLAYER_ENTERING_WORLD" then local isInitalLogin, isReloadUI = ... elseif event == "BAG_OPEN" then local bagID = ... end end) Frame:RegisterEvent("PLAYER_ENTERING_WORLD") Frame:RegisterEvent("BAG_OPEN")
for example, to make it more readable what the arguments are for a particular event.
|