Skip to main content

CommandContext

Represents an individual command execution.

Properties

Dispatcher

This item is read only and cannot be modified. Read Only
CommandContext.Dispatcher: Dispatcher

The dispatcher that created this command context.

Cmdr

This item is read only and cannot be modified. Read Only
CommandContext.Cmdr: Cmdr | CmdrClient

The Cmdr instance this command belongs to.

Name

This item is read only and cannot be modified. Read Only
CommandContext.Name: string

The command name.

RawText

This item is read only and cannot be modified. Read Only
CommandContext.RawText: string

The original command text.

Object

This item is read only and cannot be modified. Read Only
CommandContext.Object: CommandDefinition

The command definition.

Group

This item is read only and cannot be modified. Read Only
CommandContext.Group: any

The command group.

State

CommandContext.State: table

Temporary state storage.

Aliases

This item is read only and cannot be modified. Read Only
CommandContext.Aliases: {string}

Command aliases.

Alias

This item is read only and cannot be modified. Read Only
CommandContext.Alias: string

The alias used to invoke this command.

Description

This item is read only and cannot be modified. Read Only
CommandContext.Description: string

The command description.

Executor

This item is read only and cannot be modified. Read Only
CommandContext.Executor: Player

The player who executed this command.

ArgumentDefinitions

This item is read only and cannot be modified. Read Only
CommandContext.ArgumentDefinitions: {ArgumentDefinition}

The command argument definitions.

RawArguments

This item is read only and cannot be modified. Read Only
CommandContext.RawArguments: {string}

The raw command arguments.

Arguments

This item is read only and cannot be modified. Read Only
CommandContext.Arguments: {ArgumentContext}

The parsed arguments.

Data

CommandContext.Data: any

Command data.

Response

This item is read only and cannot be modified. Read Only
CommandContext.Response: string?

The command response.

Guards

This item is read only and cannot be modified. Read Only
CommandContext.Guards: {(CommandContext) → string?}

Command guards.

Functions

new

CommandContext.new(optionstable) → CommandContext

Creates a new command context.

Parse

CommandContext:Parse(allowIncompleteArgumentsboolean?) → (
boolean,
string?
)

Parses command arguments.

Validate

CommandContext:Validate(isFinalboolean?) → ArgumentContext?

Validates command arguments.

GetLastArgument

CommandContext:GetLastArgument() → ()

Returns the last argument containing a value.

GatherArgumentValues

CommandContext:GatherArgumentValues() → (
{any},
number
)

Gathers parsed argument values.

Run

CommandContext:Run() → string?

Runs the command.

GetArgument

CommandContext:GetArgument(indexnumber) → ArgumentContext?

Returns an argument by index.

GetData

CommandContext:GetData() → any

Returns command data.

SendEvent

CommandContext:SendEvent(
playerPlayer,
eventstring,
...any
) → ()

Sends an event to a player.

BroadcastEvent

CommandContext:BroadcastEvent(
eventstring,
...any
) → ()

Broadcasts an event to all clients.

Reply

CommandContext:Reply(
textstring,
optionsany?
) → {any}

Sends a reply to the executor.

GetStore

CommandContext:GetStore(namestring) → ()

Returns a registry store.

HasImplementation

CommandContext:HasImplementation() → boolean

Checks if the command has an implementation.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates a new command context.",
            "params": [
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "table"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "CommandContext"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 172,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Parse",
            "desc": "Parses command arguments.",
            "params": [
                {
                    "name": "allowIncompleteArguments",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                },
                {
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 202,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Validate",
            "desc": "Validates command arguments.",
            "params": [
                {
                    "name": "isFinal",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ArgumentContext?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 241,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "GetLastArgument",
            "desc": "Returns the last argument containing a value.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 262,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "GatherArgumentValues",
            "desc": "Gathers parsed argument values.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ any }"
                },
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 277,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Run",
            "desc": "Runs the command.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string?\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 297,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "GetArgument",
            "desc": "Returns an argument by index.",
            "params": [
                {
                    "name": "index",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ArgumentContext?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 353,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "GetData",
            "desc": "Returns command data.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 363,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "SendEvent",
            "desc": "Sends an event to a player.",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "event",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 379,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "BroadcastEvent",
            "desc": "Broadcasts an event to all clients.",
            "params": [
                {
                    "name": "event",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "...",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 387,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Reply",
            "desc": "Sends a reply to the executor.",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "any?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ any }\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 395,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "GetStore",
            "desc": "Returns a registry store.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 403,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "HasImplementation",
            "desc": "Checks if the command has an implementation.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 411,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Dispatcher",
            "desc": "The dispatcher that created this command context.",
            "lua_type": "Dispatcher",
            "readonly": true,
            "source": {
                "line": 24,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Cmdr",
            "desc": "The Cmdr instance this command belongs to.",
            "lua_type": "Cmdr | CmdrClient",
            "readonly": true,
            "source": {
                "line": 33,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Name",
            "desc": "The command name.",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 42,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "RawText",
            "desc": "The original command text.",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 51,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Object",
            "desc": "The command definition.",
            "lua_type": "CommandDefinition",
            "readonly": true,
            "source": {
                "line": 60,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Group",
            "desc": "The command group.",
            "lua_type": "any",
            "readonly": true,
            "source": {
                "line": 69,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "State",
            "desc": "Temporary state storage.",
            "lua_type": "table",
            "source": {
                "line": 76,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Aliases",
            "desc": "Command aliases.",
            "lua_type": "{string}",
            "readonly": true,
            "source": {
                "line": 85,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Alias",
            "desc": "The alias used to invoke this command.",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 94,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Description",
            "desc": "The command description.",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 103,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Executor",
            "desc": "The player who executed this command.",
            "lua_type": "Player",
            "readonly": true,
            "source": {
                "line": 112,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "ArgumentDefinitions",
            "desc": "The command argument definitions.",
            "lua_type": "{ArgumentDefinition}",
            "readonly": true,
            "source": {
                "line": 121,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "RawArguments",
            "desc": "The raw command arguments.",
            "lua_type": "{string}",
            "readonly": true,
            "source": {
                "line": 130,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Arguments",
            "desc": "The parsed arguments.",
            "lua_type": "{ArgumentContext}",
            "readonly": true,
            "source": {
                "line": 139,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Data",
            "desc": "Command data.",
            "lua_type": "any",
            "source": {
                "line": 146,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Response",
            "desc": "The command response.",
            "lua_type": "string?",
            "readonly": true,
            "source": {
                "line": 155,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        },
        {
            "name": "Guards",
            "desc": "Command guards.",
            "lua_type": "{ (CommandContext) -> string? }",
            "readonly": true,
            "source": {
                "line": 164,
                "path": "Cmdr/CmdrClient/Shared/Command.luau"
            }
        }
    ],
    "types": [],
    "name": "CommandContext",
    "desc": "Represents an individual command execution.",
    "source": {
        "line": 12,
        "path": "Cmdr/CmdrClient/Shared/Command.luau"
    }
}