View Single Post
11-15-16, 08:56 PM   #29
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Getting that info shouldn't be terribly CPU intensive (ie not at all), so it's fine to just get it anew when you show the tooltip. You don't wanna put the SetScript("OnEnter") inside the OnEvent, if that's what you meant. You could, but that will create a new function every time you set the script which, while equally insignificant of a performance hit, is just not something you want to get into the habit of doing.

Storing the values collected in the event handler and reusing them in the tooltip is certainly not bad. Personally I would prefer not to clutter the main scope with upvalues for such a minuscule gain, but others probably would, and strictly speaking it should be the most efficient approach. If you do choose to just get the values again in the tooltip, you might want to consider making a function for it. Writing the same code more than once (except for very small amounts) should be avoided if at all possible.
__________________
Grab your sword and fight the Horde!
  Reply With Quote