Skip to main content

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> {
CommandCommandContext<T>--

The command context this argument belongs to.

Namestring--

The name of the argument

TypeTypeDefinition<T>--

The type definition of the argument

Requiredboolean--

Whether or not this argument is required

ExecutorPlayer--

The player that ran the command this argument belongs to.

RawValuestring--

The raw value of the argument

RawSegments{string}--

The raw segments of the argument

Prefixstring--

The prefix of the argument

}

CommandContext<T>

interface CommandContext<T> {
ExecutorPlayer--

The player who executed the command

Namestring--

the name of the command

Descriptionstring--

the description of the command

Aliasstring--

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

Groupany--

The group this command is a part of. Defined in command definitions, typically a string.

RawTextstring--

the raw text of the command

RawArguments{string}--

the raw arguments of the command

Arguments{ArgumentContext<T>}--

the parsed arguments of the command

Cmdrtable
Dispatchertable--

the dispatcher that ran the command

Statetable--

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> {
DisplayNamestring--

The display name of the type

Prefixesstring--

The prefixes that this type can use

Transform(
rawTextstring,
executorPlayer
) → any--

A function that transforms the raw text into the desired type

Validate(valueT) → (
boolean,
string?
)--

A function that validates the value. Returns a boolean and an optional error message.

ValidateOnce(valueT) → (
boolean,
string?
)--

A function that validates the value once. Returns a boolean and an optional error message.

Autocomplete(valueT) → (
{string},
{IsPartialboolean?}
)--

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.

Parse(valueT) → any--

A function that parses the value

Default(plrPlayer) → string--

A function that returns the default value for the type

Listableboolean--

Whether or not this type is listable

}

CommandArgument

interface CommandArgument {
Typestring | TypeDefinition<any>--

The type of the argument

Namestring--

The name of the argument

Descriptionstring--

The description of the argument

Optionalboolean--

Whether or not this argument is optional

Defaultany--

The default value of the argument

}

CommandDefinition<T>

interface CommandDefinition<T> {
Namestring--

The name of the command

Descriptionstring--

The description of the command

Aliases{string}?--

The aliases of the command

Groupany?--

The group this command is a part of

Args{CommandArgument | (contextCommandContext<T>) → CommandArgument}--

The arguments of the command

Data((
contextCommandContext<T>,
...any
) → any)?--

The data of the command

AutoExec{string}?--

The autoexec of the command

ClientRun((
contextCommandContext<T>,
...any
) → string?)?--

The client run of the command

}
Show raw api
{
    "functions": [],
    "properties": [],
    "types": [
        {
            "name": "ArgumentContext<T>",
            "desc": "",
            "fields": [
                {
                    "name": "Command",
                    "lua_type": "CommandContext<T>",
                    "desc": "The command context this argument belongs to."
                },
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "The name of the argument"
                },
                {
                    "name": "Type",
                    "lua_type": "TypeDefinition<T>",
                    "desc": "The type definition of the argument"
                },
                {
                    "name": "Required",
                    "lua_type": "boolean",
                    "desc": "Whether or not this argument is required"
                },
                {
                    "name": "Executor",
                    "lua_type": "Player",
                    "desc": "The player that ran the command this argument belongs to."
                },
                {
                    "name": "RawValue",
                    "lua_type": "string",
                    "desc": "The raw value of the argument"
                },
                {
                    "name": "RawSegments",
                    "lua_type": "{string}",
                    "desc": "The raw segments of the argument"
                },
                {
                    "name": "Prefix",
                    "lua_type": "string",
                    "desc": "The prefix of the argument"
                }
            ],
            "source": {
                "line": 21,
                "path": "src/cmdr/src/Shared/CmdrTypes.lua"
            }
        },
        {
            "name": "CommandContext<T>",
            "desc": "",
            "fields": [
                {
                    "name": "Executor",
                    "lua_type": "Player",
                    "desc": "The player who executed the command"
                },
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "the name of the command"
                },
                {
                    "name": "Description",
                    "lua_type": "string",
                    "desc": "the description of the command"
                },
                {
                    "name": "Alias",
                    "lua_type": "string",
                    "desc": "The specific alias of this command that was used to trigger this command (may be the same as Name)"
                },
                {
                    "name": "Aliases",
                    "lua_type": "{string}",
                    "desc": "The list of aliases that could have been used to trigger this command"
                },
                {
                    "name": "Group",
                    "lua_type": "any",
                    "desc": "The group this command is a part of. Defined in command definitions, typically a string."
                },
                {
                    "name": "RawText",
                    "lua_type": "string",
                    "desc": "the raw text of the command"
                },
                {
                    "name": "RawArguments",
                    "lua_type": "{string}",
                    "desc": "the raw arguments of the command"
                },
                {
                    "name": "Arguments",
                    "lua_type": "{ArgumentContext<T>}",
                    "desc": "the parsed arguments of the command"
                },
                {
                    "name": "Cmdr",
                    "lua_type": "table",
                    "desc": ""
                },
                {
                    "name": "Dispatcher",
                    "lua_type": "table",
                    "desc": "the dispatcher that ran the command"
                },
                {
                    "name": "State",
                    "lua_type": "table",
                    "desc": "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."
                }
            ],
            "source": {
                "line": 51,
                "path": "src/cmdr/src/Shared/CmdrTypes.lua"
            }
        },
        {
            "name": "TypeDefinition<T>",
            "desc": "",
            "fields": [
                {
                    "name": "DisplayName",
                    "lua_type": "string",
                    "desc": "The display name of the type"
                },
                {
                    "name": "Prefixes",
                    "lua_type": "string",
                    "desc": "The prefixes that this type can use"
                },
                {
                    "name": "Transform",
                    "lua_type": "(rawText: string, executor: Player) -> any",
                    "desc": "A function that transforms the raw text into the desired type"
                },
                {
                    "name": "Validate",
                    "lua_type": "(value: T) -> (boolean, string?)",
                    "desc": "A function that validates the value. Returns a boolean and an optional error message."
                },
                {
                    "name": "ValidateOnce",
                    "lua_type": "(value: T) -> (boolean, string?)",
                    "desc": "A function that validates the value once. Returns a boolean and an optional error message."
                },
                {
                    "name": "Autocomplete",
                    "lua_type": "(value: T) -> ({string}, {IsPartial: boolean?})",
                    "desc": "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."
                },
                {
                    "name": "Parse",
                    "lua_type": "(value: T) -> any",
                    "desc": "A function that parses the value"
                },
                {
                    "name": "Default",
                    "lua_type": "(plr: Player) -> string",
                    "desc": "A function that returns the default value for the type"
                },
                {
                    "name": "Listable",
                    "lua_type": "boolean",
                    "desc": "Whether or not this type is listable"
                }
            ],
            "source": {
                "line": 87,
                "path": "src/cmdr/src/Shared/CmdrTypes.lua"
            }
        },
        {
            "name": "CommandArgument",
            "desc": "",
            "fields": [
                {
                    "name": "Type",
                    "lua_type": "string | TypeDefinition<any>",
                    "desc": "The type of the argument"
                },
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "The name of the argument"
                },
                {
                    "name": "Description",
                    "lua_type": "string",
                    "desc": "The description of the argument"
                },
                {
                    "name": "Optional",
                    "lua_type": "boolean",
                    "desc": "Whether or not this argument is optional"
                },
                {
                    "name": "Default",
                    "lua_type": "any",
                    "desc": "The default value of the argument"
                }
            ],
            "source": {
                "line": 108,
                "path": "src/cmdr/src/Shared/CmdrTypes.lua"
            }
        },
        {
            "name": "CommandDefinition<T>",
            "desc": "",
            "fields": [
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "The name of the command"
                },
                {
                    "name": "Description",
                    "lua_type": "string",
                    "desc": "The description of the command"
                },
                {
                    "name": "Aliases",
                    "lua_type": "{string}?",
                    "desc": "The aliases of the command"
                },
                {
                    "name": "Group",
                    "lua_type": "any?",
                    "desc": "The group this command is a part of"
                },
                {
                    "name": "Args",
                    "lua_type": "{CommandArgument | (context: CommandContext<T>) -> CommandArgument}",
                    "desc": "The arguments of the command"
                },
                {
                    "name": "Data",
                    "lua_type": "((context: CommandContext<T>, ...any) -> any)?",
                    "desc": "The data of the command"
                },
                {
                    "name": "AutoExec",
                    "lua_type": "{string}?",
                    "desc": "The autoexec of the command"
                },
                {
                    "name": "ClientRun",
                    "lua_type": "((context: CommandContext<T>, ...any) -> string?)?",
                    "desc": "The client run of the command"
                }
            ],
            "source": {
                "line": 128,
                "path": "src/cmdr/src/Shared/CmdrTypes.lua"
            }
        }
    ],
    "name": "CmdrTypes",
    "desc": "This class is a collection of types used in Cmdr. Some of the comments here may not be entirely accurate.",
    "source": {
        "line": 7,
        "path": "src/cmdr/src/Shared/CmdrTypes.lua"
    }
}