File CommandManager.lua

Functions

CM:AutoHelp () Prints all command names together with their help messages.
CM:GetCommand (command) Gets the callback for a command by name.
CM:HandleCommand (command, args, isChat, player) Calls command with supplied args.
CM:HasCommand (command) Check whether or not a command is registered.
CM:Init () Initialize CommandManager.
CM:Register (names, access, func, help, command) Register a new command.

Tables

Command.CommandManager Table holding all CommandManager methods.


Functions

CM:AutoHelp ()
Prints all command names together with their help messages.
CM:GetCommand (command)
Gets the callback for a command by name.

Parameters:

  • command: Name of the command to get.

Return value:

    Callback for the command, nil if no command was found.
CM:HandleCommand (command, args, isChat, player)
Calls command with supplied args.

Parameters:

  • command: Command to call (name)
  • args: Table with arguments for the command.
  • isChat: Is the command called from chat?
  • player: Player object of the calling player (if chat)

Return values:

  1. If successfull, returns result, otherwise false.
  2. Error message if not successful, otherwise nil.
CM:HasCommand (command)
Check whether or not a command is registered. This does NOT take aliases into account.

Parameters:

  • command: Command name to check.
CM:Init ()
Initialize CommandManager. NOTE: Unused.
CM:Register (names, access, func, help, command)
Register a new command.

Parameters:

  • names:
  • access: Number depicting the access level needed to execute command.
  • func: Function called to execute command. Called with params args, player and isChat.
  • help: Message describing how the command should be used.
  • command: Table containing aliases for the command.

Tables

Command.CommandManager
Table holding all CommandManager methods. This is referenced "CM" in CommandManager.lua.

Fields:

  • Slash: List of slash commands to register.
  • Commands: Table holding all registered commands.

Valid XHTML 1.0!