HookScript third argument - bindingType

Update #2:
The third argument relates to intrinsicOrder added in patch 7.1.0.
https://blue.mmo-champion.com/topic/772205-notable-ui-changes-coming-in-71/


Update #1:

  • Credits to Meorawr on Discord: when passing multiple functions (to include an arbitrary number of arguments, not just 3), only the last one is used when HookScript adds a handler where before there was none (ie, SetScript was nil).

Original Post:
Does anyone know what the third argument is intended for in the following function?

frame:HookScript("frameScriptTypeName", function[, bindingType])

I ran some tests hooking the OnMouseDown handler to a generic frame and came up with the following:

  • When the third argument is nil:
    • HookScript enables the mouse and hooks the second argument
  • When the third argument is a number:
    • If the third argument is 1, then HookScript enables the mouse and hooks the second argument
    • Else, HookScript does nothing (ie, silently fails with 0 or 2)
  • When the third argument is a function:
    • If the mouse is already enabled, then HookScript hooks the second argument
    • Else, it enables the mouse and hooks the third argument
  • When the third argument is a string, boolean or table:
    • HookScript throws an error.

It isn’t obvious to me, from this test, what its actually intended to do.

2 Likes