Events
The Events module provides mechanisms to manage event-driven programming by allowing registration of functions that respond to specific event types through on for persistent listeners and once for single-use listeners, with the ability to deregister these listeners using off, making it suitable for applications requiring dynamic and responsive interaction with different systems or user-generated events.
Usage
To use this module, add the following require at the top of your script:
Reference
__init
__clear
on
Start listening to events of a certain type. This method will take an event type and a function to call if the event is triggered.
Parameters
eventtype(string): Type of the event. See possible types of events belowfunc(function): function to call
once
Listen to the next event of a certain type. After the event is triggered once, the event listener will automatically deactivate again. This method will take an event type and a function to call if the event is triggered.
Parameters
eventtype(string): Type of the event. See possible types of events belowfunc(function): function to call
off
Stop listening to events of a certain type. Clears all events of the given type for this script entity.
Parameters
eventtype(string): Type of the event
emitExternal
Parameters
eventtypevalue
translate
Parameters
e
processIncoming
Parameters
e
debugStats
Examples
For examples and more information, see Handling Events.