Test/event: Difference between revisions
Jump to navigation
Jump to search
imported>OCDoc Import Imported from legacy OpenComputers documentation at ocdoc.cil.li |
Clean up Markdown artifacts from DokuWiki migration |
||
| Line 5: | Line 5: | ||
{| | {| | ||
! Syntax | ! Syntax | ||
! | ! <code>event.listen(event: string, callback: function): boolean</code> | ||
|} | |} | ||
| Line 25: | Line 25: | ||
|- | |- | ||
| Returns | | Returns | ||
| | | <code>true</code> if the event was successfully registered, <code>false</code> if this function was already registered for this event type. | ||
|} | |} | ||
Latest revision as of 20:28, 24 August 2026
===== event listen
===== Syntax
| Syntax | event.listen(event: string, callback: function): boolean
|
|---|
===== Description
| Description | Register a new event listener that should be called for events with the specified name. |
|---|
===== Details
| Arguments | event - name of the signal to listen to. |
|---|---|
| callback - the function to call if this signal is received. The function will receive the event name it was registered for as first parameter, then all remaining parameters as defined by the signal that caused the event. | |
| Returns | true if the event was successfully registered, false if this function was already registered for this event type.
|