grandMA3 User Manual Publication

UnhookMultiple(function, handle, handle)

grandMA3 User Manual » Plugins » Lua Functions - Object-Free API » UnhookMultiple(function, handle, handle)
Version 2.1

Description

The UnhookMultiple Lua function unhooks multiple hooks based on an input. This input acts like a filter to identify all the hooks that should be unhooked.

The DumpAllHooks function can be used to list all the existing hooks in the system.

Arguments

  • Function or nil:
    This must be the name of a triggered function or nil.
  • Handle or nil:
    This must be the handle for the target object or nil.
  • Handle or nil:
    The must be the handle for the context object or nil.

The target and context names can be seen using the DumpAllHooks function.

Return

  • Integer:
    The function returns an integer indicating how many hooks were unhooked.


Hint:
See also these related functions: DumpAllHooks, HookObjectChange, Unhook.

Example

This example unhooks all hooked related to the function created in the example for the HookObjectChange - please run the example from that topic before running this one.

Lua
return function ()
-- Unhooks all hooks related to the "MySequencePoolCallback" function.
local amount = UnhookMultiple(MySequencePoolCallback)
-- Print how many hooks that were unhooked.
Printf(amount .. " hook(s) were unhooked.")
end