Thread: Event arguments
View Single Post
12-05-10, 07:17 PM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
self and event are always passed with the event, the rest varies from event to event.

Take UNIT_AURA for example, it passes "unitid" as well as those mentioned above [1]. But you have to catch it yourself nowadays.

So your example would either be (only showing the relevant bits):
Code:
OnEvent:SetScript("OnEvent", function(self, event, ...)
if event == "UNIT_AURA" then
   local unit = select(1, ...)
   if unit == "target" then 
      <snip>
or

Code:
OnEvent:SetScript("OnEvent", function(self, event, unit, ...)
   if unit == "target" then
      <snip>
Either way is fine, but the latter basically assumes you've only registered for the UNIT_AURA event (or any other event with that particular signature) while the first can be used for other events as well.

[1] http://wowprogramming.com/docs/events/UNIT_AURA
__________________
Oh, the simulated horror!

Last edited by Ailae : 12-05-10 at 07:20 PM. Reason: Clarification..
  Reply With Quote