Skip to content

smelt.cmd

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

Register and list slash commands. cmd.run is injected by the TUI layer so it can access the live app state.

smelt.cmd.list

fun(): table

Return every registered slash command as a Lua array of { name, desc, args, while_busy, queue_when_busy, startup_ok, hidden } rows. Sorted by name.

smelt.cmd.register

fun(name: string, handler: fun(value: string?), opts: smelt.cmd.RegisterOpts?): smelt.Reg

Types: smelt.cmd.RegisterOpts, smelt.Reg

Register a slash command name whose handler is invoked when the user runs it. opts accepts desc, args, while_busy (default true), queue_when_busy (default false), startup_ok (default false), and hidden (default false). Returns a Reg whose :remove() unregisters the command.

smelt.cmd.run

fun(line: string): nil

Execute the slash-command line line (with or without leading /) as if the user had typed it. Errors are surfaced as in-app notifications.