View Single Post
01-20-15, 08:05 AM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by AnrDaemon View Post
I've also dropped a check for "func = handler[func]" as redundant and not really adding to the performance.
I assume you mean this part:
Code:
    if handler then
        func = handler[func]
    end
This is there so you can register events AceEvent-style:

Code:
addon:RegisterEvent("PLAYER_LOGIN", "InitializeAllTheThings", addon)
But yes, you would need to remove it (or change it to a type check) if you wanted to use this syntax instead:

Code:
addon:RegisterEvent("PLAYER_LOGIN", addon.InitializeAllTheThings, addon)
However, there's no possibly imaginable performance concern to a single "if value then" check in a function that's only called when you're unregistering an event, so if that's really your motivation for removing it -- don't.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote