RegisterHookFunction: Difference between revisions

From VisionaireWiki
Jump to navigation Jump to search
(Created page with "==registerHookFunction== Registers a hook function for a specific operation. Lua Syntax: <pre>registerHookFunction(hook, hookFunction)</pre> ===Arguments=== ====hook==== :'''"...")
 
No edit summary
 
Line 8: Line 8:
===Arguments===
===Arguments===
====hook====
====hook====
:'''"string"''' - The operation for which the hook function should be called. Currently supported hooks: "setTextPosition" (the hook is called everytime the position of a displayed text is set).
:'''"string"''' - The operation for which the hook function should be called. Currently supported hooks: "setTextPosition" (the hook is called everytime the position of a displayed text is set), "getActionText" (the hook is called everytime to get the currently displayed action text).
====hookFunction====
====hookFunction====
:'''"string"''' - The name of the lua function which is called when the hook is executed. The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook).
:'''"string"''' - The name of the lua function which is called when the hook is executed. "setTextPosition": The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook).
:"getActionText": The function should take exactly one argument which is the current mouse position (a table containing x- and y-position). The function must return a string value which will be used as the current action text.
===Flags===
===Flags===
===Return Values===
===Return Values===
None.
None.

Latest revision as of 20:38, 11 July 2012

registerHookFunction

Registers a hook function for a specific operation.

Lua Syntax:

registerHookFunction(hook, hookFunction)

Arguments

hook

"string" - The operation for which the hook function should be called. Currently supported hooks: "setTextPosition" (the hook is called everytime the position of a displayed text is set), "getActionText" (the hook is called everytime to get the currently displayed action text).

hookFunction

"string" - The name of the lua function which is called when the hook is executed. "setTextPosition": The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook).
"getActionText": The function should take exactly one argument which is the current mouse position (a table containing x- and y-position). The function must return a string value which will be used as the current action text.

Flags

Return Values

None.