Thread Tools Display Modes
01-19-15, 07:25 PM   #21
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Originally Posted by Phanx View Post
Oh, you're right, I wasn't looking at that part. That line should probably be changed to:

Code:
		if func and f[event] and f[event][func] ~= nil then
Yup. I did exactly that, when implementing your suggestion.
I've also dropped a check for "func = handler[func]" as redundant and not really adding to the performance.
So far, so good. Though, I should admit, that looking at someone else's code when writing your own tend to cause more harm than good
Mistyped variable names make it quite hard to debug issues. Especially when they do not cause outright errors.
  Reply With Quote
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
01-20-15, 09:49 AM   #23
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
I didn't mean "performance" as a "speed up" (English language is so prone to a word play…)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Little help fixing too flashy garrison frames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off