It seems I have to hook the function to 'PetActionBar_Update' to access the pet action bar, but I am getting some weird LUA error.
Code:
Interface\FrameXML\SecureHandlers.lua:610: Header frame must be explicitly protected
Interface\FrameXML\SecureHandlers.lua:610: in function `SecureHandlerWrapScript'
I found the error specified in here:
https://github.com/Ennie/wow-ui-sour...dlers.lua#L596
Can I get around this or is the frame protected and untouchable?
Here is the code:
Code:
hooksecurefunc('PetActionBar_Update', function(button)
if InCombatLockdown() then return end -- can't hook functions in combat
if not button.hooked then
local actionButtonType, key
actionButtonType = button:GetAttribute('binding') or string.upper(button:GetName())
actionButtonType = replace(actionButtonType, 'PETACTION', 'BONUSACTION')
local key = GetBindingKey(actionButtonType)
if key then
button:RegisterForClicks("AnyDown")
SetOverrideBindingClick(button, true, key, button:GetName(), "LeftButton")
end
button.AnimateThis = animate
-- the next line causes the error
SecureHandlerWrapScript(button, "OnClick", button, [[ control:CallMethod("AnimateThis", self) ]])
button.hooked = true
end
end)