Skip to content

commands ​

INFO

Сам справочник на английском: он создаётся автоматически из WIT-файлов.

Chat and console commands registered by mods. A registered command is routed to its mod for every allowed sender, before the built-in commands. Vanilla only treats / lines from moderators and admins as commands; mod commands work for any player unless min-role says otherwise.

Package blockheads:api@0.3.1 · Lua table bh.commands · WIT source

Uses: types.{api-error}, players.{role}, events.{command-sender}

Types ​

command-id type ​

txt
type command-id = u32;

Identifies one registered command of the calling mod.

command-spec record ​

Describes a command.

FieldTypeDescription
namestringThe name without /: [a-z0-9_-]{1,32}. Must not collide with built-in or other mods' commands.
aliaseslist<string>Extra names, same rules as name.
descriptionstringOne line of help text.
usagestringUsage text shown when the handler returns handled = false, for example /home [name].
min-roleroleThe lowest role allowed to run it from chat.
consoleboolWhether the console may run it.

command-outcome record ​

What a command handler returns.

FieldTypeDescription
handledboolFalse shows the usage text to the sender.
replylist<string>Lines sent back to the sender (chat for players, log for the console).

Functions ​

register function ​

txt
register: func(spec: command-spec) -> result<command-id, api-error>;

Registers a command; the host calls guest.run-command when it is used.

unregister function ​

txt
unregister: func(id: command-id) -> bool;

Removes a command. Returns false if it did not exist.

Неофициальный проект сообщества. Не связан с Majic Jungle Software или Noodlecake. Файлы игры не включены.