View Single Post
03-24-13, 01:17 PM   #48
fRodzet
A Flamescale Wyrmkin
Join Date: Mar 2013
Posts: 114
Originally Posted by Phanx View Post
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
Makes sense - thanks also seems more readable to me!
  Reply With Quote