WoWInterface - View Single Post - hooksecurefunc works on funcA, but not on funcB
View Single Post
12-04-17, 11:00 AM   #4
A Chromatic Dragonspawn
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
Without checking the files I would guess that function A hook is working because Vuhdo is actually calling VUHDO_determineDebuff from outside file VuhDoDebuffs.lua and in those files the local version does not exist.

On the other hand VUHDO_customizeText is being called from within the files VuhDoBarCustomizerHealth.lua where local version is called instead of the global version. When you hook a function you in fact make another function but the local version is pointing to a pre hook version.

You can confirm with this macro

/run function a()print("function")end local f=a hooksecurefunc("a",function()print("hook")end) local g=a f()g()
f() call does NOT call the hook function because it is poiting to a version of the global function a that has no hooks

whereas g() call does call the hook function because it is a local reference to the hooked global function a.
"In this world nothing can be said to be certain, except that fractional reserve banking is a Ponzi scheme and that you won't believe it." - Mandrill

Last edited by Banknorris : 12-04-17 at 01:55 PM.
  Reply With Quote