View Single Post
02-25-19, 05:00 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Events starting with UNIT_ will pass the unit the event is for as the first parameter.

Lua Code:
  1. local Events = {}
  2. function Events.UNIT_AURA(self, ...)
  3.     local unit = ...
  4. -- check the units auras
  5. end
  6.  
  7. function Events.PLAYER_ENTERING_WORLD(self, ...)
  8.     local isInitialLogin, isReloadingUi = ...
  9. -- do whatever
  10. end
  11.  
  12. local frame = CreateFrame("FRAME", nil); -- Frame that register various events in the world
  13. frame:SetScript("OnEvent", function(self, event, ...)
  14.     Events[event](self, ...)
  15. end)
  16.  
  17. for k,_ in pairs(Events) do
  18.     frame:RegisterEvent(k)
  19. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote