View Single Post
07-26-16, 11:28 AM   #13
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
Originally Posted by Layback_ View Post
2. Because the HealthValue is the child of base frame, f, not Health frame, f.Health.

Actually, changing

f:CreateFontString(f.Health:GetName() .. "Text", "OVERLAY");

to

f.Health:CreateFontString(f.Health:GetName() .. "Text", "OVERLAY");

did solve the trick, but I personally think this is not a good coding in terms of memory efficiency.
This guess is correct and it has no impact to performance as it's just creating it as a child of a different frame. If you're talking about preforming the same indexing operation repeatedly, it depends on how frequent the function runs and how often you do it in the function. Normally, since this is just at frame creation, it should be fine as-is. In this specific example though, you can use the $parent tag at frame creation to reference the name of the frame's parent.
Code:
f.Health:CreateFontString("$parentText", "OVERLAY");
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 07-26-16 at 11:42 AM.
  Reply With Quote