Quantcast
WoWInterface - View Single Post - hooksecurefunc works on funcA, but not on funcB
View Single Post
12-04-17, 12:19 AM   #1
robertito54321
A Murloc Raider
Join Date: Aug 2012
Posts: 8
hooksecurefunc works on funcA, but not on funcB

So I'm attempting to add some code to a global function for VuhDo.
Unfortunately I cant seem to figure out why I can hook a func to 'function A', but not to 'function B'

[WORKS] Function A (VuhDo -> VuhDoDebuffs.lua):
Code:
function VUHDO_determineDebuff(aUnit)
  --Some code
end
local VUHDO_determineDebuff = VUHDO_determineDebuff;
[DOESNT WORK] Function B (VuhDo -> VuhDoBarCustomizerHealth.lua):
Code:
function VUHDO_customizeText(aButton, aMode, anIsTarget)
  --Some code
end
local VUHDO_customizeText = VUHDO_customizeText;
My testhook: (hook for function a looks the same)
Code:
  local f = CreateFrame("Frame")
  f:SetScript("OnEvent", function(self,event,...)
    if IsAddOnLoaded("VuhDo") then
      hooksecurefunc("VUHDO_customizeText", function() print("This is a test") end)
    end
  end)
  f:RegisterEvent("PLAYER_ENTERING_WORLD")
The hook for function B only seems to work when I comment out the following line:
Note: on function A I dont need to comment out anything. It always works :/
Code:
--local VUHDO_customizeText = VUHDO_customizeText;
Can someone help me out on how to debug this issue?
Code:
_G["VUHDO_customizeText"] --this exists, can I safely assume its a global function and it should work?
  Reply With Quote