Dispatcher
The Dispatcher handles parsing, validating, and evaluating commands. Exists on both client and server.
Properties
# Cmdr
Dispatcher.Cmdr:
Cmdr | CmdrClient
A reference to Cmdr. This may either be the server or client version of Cmdr depending on where the code is running.
Instance Methods
# Run
client only
Dispatcher.
Run(...:
string
) →
string
This should be used to invoke commands programmatically as the local player. Accepts a variable number of arguments, which are all joined with spaces before being run. This function will raise an error if any validations occur, since it's only for hard-coded (or generated) commands.
Parameters
Name | Type | Required | |
---|---|---|---|
... |
string
| ✔ |
Returns
Type | |
---|---|
string
|
# EvaluateAndRun
Dispatcher.
EvaluateAndRun(
string
,
executor?: Player?
,
options?: {
any?
boolean
}
string
Runs a command as the given player. If called on the client, only text is required. Returns output or error test as a string.
Parameters
Name | Type | Required | |
---|---|---|---|
commandText |
string
| ✔ | |
executor |
Player?
| ✘ | |
options | # {
} | ✘ | If |
Returns
Type | |
---|---|
string
|
# GetHistory
client only
Dispatcher.
GetHistory() →
array<string>
Returns an array of the user's command history. Most recent commands are inserted at the end of the array.
Returns
Type | |
---|---|
array<string>
|