Class ConsoleCommand

A ConsoleCommand is a special type of (global) variable that represents a command that can be executed through the engine's console.

To declare a ConsoleCommand in C++ code, you can do the following:

The ConsoleCommand will be thread-safe registered upon creation of the respective instance and automatically thread-safe unregistered when the instance is deallocated. This makes the ConsoleCommand suitable for use in both the global scope of the application, and locally within a class, to expose functionality while the class is alive.

The execution thread depends is equal to the source of the execution. The number of arguments depend on the execution string. It's best to not assert on expectionations, but provide runtime help to the user if the argument contents or size do not match the requirements of the ConsoleCommand.

In the above example, the first parameter is the command name. It is a case-insensitive unique identifier that is used to set invoke the command through the application-wide console. If a command with same name is already registered, the registration will be declined and an error is reported. Note that the name comparision is done case-insensitive.

The second parameter is a command description. This string is used to explain to the user what the command is, what it's purpose is and the arguments. The description will be printed when the enters help <name> or if the only argument passed to the command execute is help.

The third parameter is the delegate that will be invoked when the user executes the command.

Hierarchy

  • FrameworkObject
    • ConsoleCommand

Constructors

Accessors

Methods

Constructors

  • Creates a new instance with the specified name.

    Parameters

    • name: string

      The command name that is used to invoke the command. Only alpha-numeric without spaces.

    • description: string

      The description of the command.

    • delegate: ((arg0: string[]) => void)

      The delegate that will be invoked upon command execution.

        • (arg0): void
        • Parameters

          • arg0: string[]

          Returns void

    • OptionalisInternalConstructor: boolean

    Returns ConsoleCommand

    The newly allocated ConsoleCommand.

Accessors

  • get delegate(): ((arg0: Iterable<string>) => void)
  • Gets the delegate.

    Returns ((arg0: Iterable<string>) => void)

      • (arg0): void
      • Parameters

        Returns void

  • get description(): string
  • Gets the description.

    Returns string

  • get name(): string
  • Gets the name.

    Returns string

Methods

  • Unregisters the ConsoleCommand with the manager.

    Returns boolean