Field manual / Level editor
events — Events
The event bus between components (§14.1). OpenGorky only.
Summary
events::Emit | Calls the handlers of the event's subscribers in subscription order with the remaining arguments (as is); returns how many were called. |
events::Subscribe | From a component method: this instance hears the event through its method handler (§14.1). |
events::Unsubscribe | Removes the calling instance's subscriptions to the event (with handler, only that one); returns how many were removed. |
Functions
events::Emit(string event, ?any args...) → int
Calls the handlers of the event's subscribers in subscription order with the remaining arguments (as is); returns how many were called. No deeper than 8 nested levels; in battle, writes a log line emit name n=….
events::Subscribe(string event, method handler) → bool
From a component method: this instance hears the event through its method handler (§14.1). method is the name of a method of the calling component and is checked at link time.
events::Unsubscribe(string event, ?method handler) → int
Removes the calling instance's subscriptions to the event (with handler, only that one); returns how many were removed.