LuaCommandProcessor

Custom game console commands. Similar to event subscriptions, added commands don't persist through save and load.

class LuaCommandProcessor - sort
add_command(name, help, function) Add a command.
remove_command(string) → boolean Removes a registered command
commands :: dictionary stringLocalisedString [R] Commands registered by scripts through LuaCommandProcessor.
game_commands :: dictionary stringLocalisedString [R] Builtin commands of the core game.
object_name :: string [R] This objects name.
add_command(name, help, function)

Add a command.

The function registered to the command is passed a table when the command is invoked. The table contains:

  • name :: string: Name of the command.
  • tick :: uint: Tick the command was used.
  • player_index :: uint: The player who used the command.
  • parameter :: string (optional): The parameter passed after the command, separated from the command by 1 space.

Parameters
name :: string: Name of the command (case sensitive).
help :: LocalisedString: The localised help message.
function :: function: The function that will be called when this command is invoked.
Note: It is an error if the given command name is already registered or already exists as a game command.
remove_command(string) → boolean

Removes a registered command

Parameters
Return value
If the command was removed. False if the command didn't exist.
commands :: dictionary stringLocalisedString [Read-only]

Commands registered by scripts through LuaCommandProcessor.

game_commands :: dictionary stringLocalisedString [Read-only]

Builtin commands of the core game.

object_name :: string [Read-only]

This objects name.