wowpedia
Main Menu


Securely posthooks the specified function. The hook will be called with the same arguments after the original call is performed.

hooksecurefunc([table,] functionName, hookfunc)

Arguments

table
Optional Table - Table to hook the functionName key in; if omitted, defaults to the global table (_G).
functionName
string - name of the function being hooked.
hookfunc
function - your hook function.

Example

The following calls hook CastSpellByName and GameTooltip:SetUnitBuff without compromising their secure status. When those functions are called, the hook prints their argument list into the default chat frame.

hooksecurefunc("CastSpellByName", print); -- Hooks the global CastSpellByName
hooksecurefunc(GameTooltip, "SetUnitBuff", print); -- Hooks GameTooltip.SetUnitBuff

Details

<OnHide function="MacroFrame_OnHide"/>
The function ID called when the frame is hidden is the former one, before you hooked "MacroFrame_OnHide". The workaround is to hook a function called by "MacroFrame_OnHide":
hooksecurefunc(MacroPopupFrame, "Hide", MyFunction)
MacroPopupFrame:HookScript("OnHide", MyFunction)