The
PAPERDOLL_STATINFO table has a table with an
updateFunc for each player stat key.
I wanted to replace the behavior for armor, so I just created another update function with the modifications I wanted and assigned it, overwriting the old value:
Code:
PAPERDOLL_STATINFO["ARMOR"].updateFunc = theNewFunc
PaperDollFrame_UpdateStats() -- I called this afterward to force an update.
This code has been running in my UI for weeks now. I was looking into pulling it out of _DevPad and putting it into a standalone addon; so, I was doing some research into how other addons modify the stat tooltips. I found one addon that includes, as a side feature, the changes I made to the armor tooltip. Our implementations were nearly identical, except they do this:
Code:
hooksecurefunc(
PAPERDOLL_STATINFO["ARMOR"],
"updateFunc",
function (statFrame, unit)
-- ...
statFrame:HookScript("OnEnter", Armor_OnEnter)
end
)
So, is it necessary to do a secure hook here?