Allows for the registration of custom console commands. Similarly to event subscriptions, these don't persist through a save-and-load cycle.
|add_command(name, help, function)||Add a custom console command.|
|remove_command(name) → boolean||Remove a custom console command.|
|commands :: dictionary[string → LocalisedString] [R]|| Lists the custom commands registered by scripts through |
|game_commands :: dictionary[string → LocalisedString] [R]||Lists the built-in commands of the core game.|
|object_name :: string [R]||This object's name.|
Add a custom console command.
nameof a game command or the name of a custom command that is already in use will result in an error.
print_tickthat prints the current tick to either the player issuing the command or to everyone on the server, depending on the command parameter. It shows the usage of the table that gets passed to any function handling a custom command. This specific example makes use of the
tickand the optional
parameterfields. The user is supposed to either call it without any parameter (
"/print_tick") or with the
commands.add_command("print_tick", nil, function(command)
if command.player_index ~= nil and command.parameter == "me" then
Remove a custom console command.
falseif the command didn't exist.
Lists the custom commands registered by scripts through
Lists the built-in commands of the core game. The wiki has an overview of these.
This object's name.