Events starting with UNIT_ will pass the unit the event is for as the first parameter.
Lua Code:
local Events = {}
function Events.UNIT_AURA(self, ...)
local unit = ...
-- check the units auras
end
function Events.PLAYER_ENTERING_WORLD(self, ...)
local isInitialLogin, isReloadingUi = ...
-- do whatever
end
local frame = CreateFrame("FRAME", nil); -- Frame that register various events in the world
frame:SetScript("OnEvent", function(self, event, ...)
Events[event](self, ...)
end)
for k,_ in pairs(Events) do
frame:RegisterEvent(k)
end