Difference between revisions of "UnregisterEventHandler"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
 
==unregisterEventHandler==
 
==unregisterEventHandler==
  
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.8</span></div>
+
<div class="command-min-version-info">Available since: <span class="command-min-version">v4.0</span></div>
  
 
<div class="command-doc">Unregisters an event handler function for a specific event.</div>
 
<div class="command-doc">Unregisters an event handler function for a specific event.</div>
Line 9: Line 9:
 
===Arguments===
 
===Arguments===
 
====event====
 
====event====
:'''"string"''' - The event which triggers the event handler to be called. Currently supported events: "mainLoop".
+
:'''"string"''' - The event which triggers the event handler to be called. Currently supported events: "mainLoop", "mouseEvent".
 
====eventHandler====
 
====eventHandler====
 
:'''"string"''' - The name of the lua function which is called when the event occurs.  
 
:'''"string"''' - The name of the lua function which is called when the event occurs.  
Line 22: Line 22:
 
end
 
end
  
registerEventHandler("mainLoop", "onMainLoop")unregisterEventHandler("mainLoop", "onMainLoop")
+
registerEventHandler("mainLoop", "onMainLoop")
 +
-- ... later on, when the main loop event handler is not needed anymore:
 +
unregisterEventHandler("mainLoop", "onMainLoop")
 
</syntaxhighlight>
 
</syntaxhighlight>
[[Category:Player Commands]]
 

Revision as of 21:28, 30 September 2014

unregisterEventHandler

Available since: v4.0
Unregisters an event handler function for a specific event.

Lua Syntax:

unregisterEventHandler(event, eventHandler)

Arguments

event

"string" - The event which triggers the event handler to be called. Currently supported events: "mainLoop", "mouseEvent".

eventHandler

"string" - The name of the lua function which is called when the event occurs.

Flags

Return Values

None.

Examples

Example 1: mainLoop

function onMainLoop()
-- do something
end

registerEventHandler("mainLoop", "onMainLoop")
-- ... later on, when the main loop event handler is not needed anymore:
unregisterEventHandler("mainLoop", "onMainLoop")