Hello all!
I've come across this bit of code that puts the % of HP in the center of Nameplates. However, now it starts throwing major errors when you try to type anything in chat and it seems to cause an infinite taint. I was wondering if anybody might know of a way to fix this bit of code so that it works with todays version of WoW? Or possibly even come up with a new way to achieve this? Any help is appreciated, and thank you in advance!
Here is the Lua:
Lua Code:
CreateFrame('frame'):SetScript('OnUpdate', function(self, elapsed)
for index = 1, select('#', WorldFrame:GetChildren()) do
local f = select(index, WorldFrame:GetChildren())
if f:GetName() and f:GetName():find('NamePlate%d') then
f.h = select(1, select(1, f:GetChildren()):GetChildren())
if f.h then
if not f.h.v then
f.h.v = f.h:CreateFontString(nil, "ARTWORK")
f.h.v:SetPoint("CENTER", 5, 0)
f.h.v:SetFont(STANDARD_TEXT_FONT, 9, 'OUTLINE')
else
local _, maxh = f.h:GetMinMaxValues()
local val = f.h:GetValue()
f.h.v:SetText(string.format(math.floor((val/maxh)*100)).." %")
end
end
end
end
end)
Here is the Error that Bug Sack is logging:
2269x Custom Settings\Custom Settings.lua:88: Attempt to access forbidden object from code tainted by an AddOn
[C]: in function `GetName'
Custom Settings\Custom Settings.lua:88: in function <Custom Settings\Custom Settings.lua:85>
Locals:
(*temporary) = <unnamed> {
0 = <userdata>
}