Skip to content

smelt.events

Tier: Host - Available in every runtime, including headless mode.

Visibility: Public - Stable Lua API intended for user config and plugins.

Occurrence-oriented subscriptions over event-shaped signals such as turn_start, tool_start, and turn_complete. Use smelt.signal when the current value matters; use smelt.events.on when only future occurrences matter.

smelt.events.emit

fun(event: smelt.events.Name, payload: any): nil

Types: smelt.events.Name

Publish payload for the event named event. Custom events are declared automatically on first emit.

smelt.events.new

fun(event: smelt.events.Name): nil

Types: smelt.events.Name

Declare an event named event. Existing signals are left unchanged. smelt.events.on and smelt.events.emit also declare custom events automatically, so this is only needed when a plugin wants to document its event surface explicitly.

smelt.events.on

fun(event: smelt.events.Name, handler: fun(value: any)): smelt.Reg

Types: smelt.events.Name, smelt.Reg

Register handler(payload) for the event named event. Custom events are declared automatically before subscribing. Returns a Reg whose :remove() unsubscribes.