View Single Post
03-23-13, 07:37 PM   #47
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I don't have time to look over it in detail at the moment, but I did notice:

Code:
local function HookHandler(self, event, func)
        self:HookScript(event, func)
end

for i = 1, NUM_CHAT_WINDOWS do
    local chatframe = _G["ChatFrame" .. i]
    HookHandler(chatframe, "OnHyperLinkEnter", MouseHoverToolTip_Show)
    HookHandler(chatframe, "OnHyperLinkLeave", MouseHoverToolTip_Hide)
end
What is the purpose of the HookHandler script? Why spend memory and CPU time wrapping :HookScript in a second function like that when you can just call it directly:

Code:
for i = 1, NUM_CHAT_WINDOWS do
    local chatframe = _G["ChatFrame" .. i]
    chatframe:HookScript("OnHyperLinkEnter", MouseHoverToolTip_Show)
    chatframe:HookScript("OnHyperLinkLeave", MouseHoverToolTip_Hide)
end
__________________
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