CmdrTypes
This class is a collection of types used in Cmdr. Some of the comments here may not be entirely accurate.
Types
ArgumentContext<T>
interface
ArgumentContext<T> {
Name:
string
--
The name of the argument
Required:
boolean
--
Whether or not this argument is required
RawValue:
string
--
The raw value of the argument
RawSegments:
{
string
}
--
The raw segments of the argument
Prefix:
string
--
The prefix of the argument
}
CommandContext<T>
interface
CommandContext<T> {
Name:
string
--
the name of the command
Description:
string
--
the description of the command
Alias:
string
--
The specific alias of this command that was used to trigger this command (may be the same as Name)
Aliases:
{
string
}
--
The list of aliases that could have been used to trigger this command
Group:
any
--
The group this command is a part of. Defined in command definitions, typically a string.
RawText:
string
--
the raw text of the command
RawArguments:
{
string
}
--
the raw arguments of the command
Cmdr:
table
Dispatcher:
table
--
the dispatcher that ran the command
State:
table
--
A blank table that can be used to store user-defined information about this command's current execution. This could potentially be used with hooks to add information to this table which your command or other hooks could consume.
}
TypeDefinition<T>
interface
TypeDefinition<T> {
DisplayName:
string
--
The display name of the type
Prefixes:
string
--
The prefixes that this type can use
Transform:
(
rawText:
string
,
executor:
Player
)
→
any
--
A function that transforms the raw text into the desired type
Validate:
(
value:
T
)
→
(
boolean
,
string?
)
--
A function that validates the value. Returns a boolean and an optional error message.
ValidateOnce:
(
value:
T
)
→
(
boolean
,
string?
)
--
A function that validates the value once. Returns a boolean and an optional error message.
Autocomplete:
(
value:
T
)
→
(
{
string
}
,
{
IsPartial:
boolean?
}
)
--
A function that returns a list of possible completions for the value. Returns a list of strings and an optional boolean indicating if the completions are partial.
Listable:
boolean
--
Whether or not this type is listable
}
CommandArgument
interface
CommandArgument {
Type:
string
|
TypeDefinition
<
any
>
--
The type of the argument
Name:
string
--
The name of the argument
Description:
string
--
The description of the argument
Optional:
boolean
--
Whether or not this argument is optional
Default:
any
--
The default value of the argument
}
CommandDefinition<T>
interface
CommandDefinition<T> {
Name:
string
--
The name of the command
Description:
string
--
The description of the command
Aliases:
{
string
}
?
--
The aliases of the command
Group:
any?
--
The group this command is a part of
Args:
{
CommandArgument
|
(
context:
CommandContext
<
T
>
)
→
CommandArgument
}
--
The arguments of the command
AutoExec:
{
string
}
?
--
The autoexec of the command
}