View Single Post
01-19-14, 10:02 AM   #1
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
to hook or not to hook

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?
  Reply With Quote