Difference between revisions of "Global Command: unregisterEventHandler"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "Unregister an event handler for a specific engine event which had been registered before. {| class="ts" |- | style="width:15%" | Related functions | Global Command: registe...") |
|||
Line 10: | Line 10: | ||
== Syntax == | == Syntax == | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | unregisterEventHandler( | + | unregisterEventHandler(eventType, handler) |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 23: | Line 23: | ||
! Description | ! Description | ||
|- | |- | ||
− | | rowspan="9" | | + | | rowspan="9" | eventType |
| rowspan="9" | string | | rowspan="9" | string | ||
| "actionArea" | | "actionArea" |
Latest revision as of 10:19, 11 August 2023
Unregister an event handler for a specific engine event which had been registered before.
Related functions | registerEventHandler |
Syntax
unregisterEventHandler(eventType, handler)
Parameters
Parameter | Type | Supported values | Description |
---|---|---|---|
eventType | string | "actionArea" | The type of event which triggers the event handler. |
"animationStarted" | |||
"animationStopped" | |||
"engineEvent" | |||
"keyEvent" | |||
"mainLoop" | |||
"mouseEvent" | |||
"textStarted" | |||
"textStopped" | |||
handler | string | The name of the function which is called when the event occurs. |
Return values
none
Examples
Example 1: Register and unregister an event handler function for the main loop.
local counter = 1
function onMainLoop()
print(counter)
if counter == 100 then
unregisterEventHandler("mainLoop", "onMainLoop")
else
counter = counter + 1
end
end
registerEventHandler("mainLoop", "onMainLoop")