1. I'm trying to write an addon that uses DisableSpellAutocast. According to WoW, this is a "protected" function, so I have to use post hooking. I have searched everywhere for an example of hooksecurefunc that makes sense to me and I'm still baffled. I'm an old school C programmer, yet this concept evades me.

    What I want to know is a) Where do I put the hooksecurefunc at in my LUA file and b) What is the proper syntax for hooksecurefunc?

    Here's the function that I have DisableSpellAutocast in:

     function AutoGrowl_OnEvent(self, event, ...)
        if (event == "PARTY_MEMBERS_CHANGED") then
          for i=1, NUM_PET_ACTION_SLOTS, 1 do
            local name, subtext, texture, isToken, isActive, autoCastAllowed, autoCastEnabled = GetPetActionInfo(i);
            if  (name == "Growl")  then
              if (autoCastEnabled) then
                 DisableSpellAutocast("Growl")
              end
            end
          end
        end
     end
    

    If it's a protected function you can never call it, that's the nature of protected functions. You can't automatically disable/enable auto-cast of spells without user action (i.e. clicking on a button set up to do specifically that). I also don't think the secure template system offers a way to do this.

    hooksecurefunc() only allows you to set a function to be called anytime the original function is called. It doesn't overwrite it in any way, and the original function will continue to function.