nut.command
Chat Command module.
Handles registration, parsing, and execution of chat and console commands.
Functions
nut.command.add (command, data)
nut.command.add
Adds a new command to the list of commands.
Parameters:
string command Command nametable data Command definition table
See also:
nut.command.extractArgs (text)
nut.command.extractArgs
Internal
This is used internally - although you're able to use it you probably shouldn't.
Gets a table of arguments from a string.
Parameters:
string text Input text to parseReturns:
table Extracted argumentsnut.command.findFaction (client, name)
nut.command.findFaction
Finds a faction based on the uniqueID, and then the name if no such uniqueID exists.
Parameters:
Client client Command sourcestring name Faction name or ID
Returns:
table Faction data or nilnut.command.run (client, command, arguments)
nut.command.run
Forces a player to run a command.
Parameters:
Client client Player running commandstring command Command name
table arguments Command arguments
nut.command.parse (client, text, realCommand, arguments)
nut.command.parse
Add a function to parse a regular chat string.
Parameters:
Client client Player running commandstring text Full command text
string
realCommand
optional
Pre-extracted command name
table
arguments
optional
Pre-extracted arguments
Returns:
bool Whether a command was executednut.command.send (command, ...)
nut.command.send
Sends a command from client to server
Parameters:
string command Command namevararg ... Command arguments
Tables
CommandDef
CommandDef
Configuration table for command definitions
Fields:
vararg group String/table of allowed usergroupsvararg alias String/table of command aliases
string
syntax
Command usage syntax (e.g. "
function onRun Function(client, args) - Command execution callback
function onCheckAccess Function(client) - Permission check
boolean adminOnly Boolean shortcut for admin-only commands
boolean superAdminOnly Boolean shortcut for superadmin-only commands
string realCommand Original command name if different from registered name