RSS

Суббота, 02.11.2024, 23:14
Главная » WoW API » API Виджеты » Скриптовый объект »

Minimap:HookScript("scriptType", handler)

[ править ]
Securely hooks a script handler.
[клоны]
Securely hooks a script handler. Equivalent to hooksecurefunc() for script handlers; allows one to "post-hook" a secure handler without tainting the original.

The original handler will still be called, but the handler supplied will also be called after the original, with the same arguments. Return values from the supplied handler are discarded. Note that there is no API to remove a hook from a handler: any hooks applied will remain in place until the UI is reloaded.

If there was no prior script handler set, then this simply sets the new function as the handler for the script type.


Signature:
Code
ScriptObject:HookScript("scriptType", handler)

Arguments:
  • scriptType - Name of the script whose handler should be hooked (string)
  • handler - A function to be called whenever the script handler is run (function)

Examples:
-- hooks the default UI's player frame to insert a chat link to the player's
-- most recently completed achievement when shift-clicked
function PlayerLink(self, button, down)
if ( IsModifiedClick("CHATLINK") ) then
local link = GetAchievementLink(select(1,GetLatestCompletedAchievements()))
ChatEdit_InsertLink (link)
end
end
PlayerFrame:HookScript("OnClick", PlayerLink)

Также смотрите: Скриптовый объект
Ссылки: http://wowprogramming.com/docs/widgets/ScriptObject/HookScript