Originally Posted by Layback_
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");