Skip to main content

events

Named events between scripts. A node subscribes to a name and hears it as its script's on_<name> method; anything may emit. Delivery is at the top of the next frame's update, in emission then subscription order, so a handler never runs inside the call that emitted. emitted is the asking twin, for a script that would rather look than declare a method.

4 functions, 0 constants. Scripts reach it as events::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

functionacts onwhat it does
emit(string, any?)Queue an event for every subscriber, delivered at the top of the next frame's update.
emitted(string) -> anyThe payloads delivered under this name this frame, in emission order; empty when none were.
subscribe(node, string)Hear an event on this node, as its script's on_<name>(payload). Subscribing twice is once.
unsubscribe(node, string)Stop hearing an event on this node. Not an error when it was never subscribed.