CCommand: Difference between revisions

From Sven Co-op
Jump to navigation Jump to search
Outerbeast (talk | contribs)
Created page with "CCommand is a container class that stores command arguments, typically those from console commands or game chat. Type: Reference type. {| class="wikitable" style="vertical-a..."
 
Outerbeast (talk | contribs)
mNo edit summary
 
Line 8: Line 8:
! Description
! Description
|-
|-
| int ArgC() const
| <code>int ArgC() const
| Gets the number of arguments.
| Gets the number of arguments.
|-
|-
| string GetCommandString() const
| <code>string GetCommandString() const
| Gets the entire command as a string.
| Gets the entire command as a string.
|-
|-
| string GetArgumentsString() const
| <code>string GetArgumentsString() const
| Gets all arguments as a single string.
| Gets all arguments as a single string.
|-
|-
| string Arg(const int iIndex) const
| <code>string Arg(const int iIndex) const
| Gets the argument by index.
| Gets the argument by index.
|-
|-
| string opIndex(const int iIndex) const
| <code>string opIndex(const int iIndex) const
| Gets the argument by index.
| Gets the argument by index.
|-
|-
| string FindArg(const string& in szArgument) const
| <code>string FindArg(const string& in szArgument) const
| Find a value for a given argument. If the argument does not exist or has no value, an empty string is returned. Otherwise, returns the value.
| Find a value for a given argument. If the argument does not exist or has no value, an empty string is returned. Otherwise, returns the value.
|-
|-
| int FindIntArg(const string& in szArgument, const int iDefault = 0) const
| <code>int FindIntArg(const string& in szArgument, const int iDefault = 0) const
| Find an int value for a given argument. Returns iDefault if no such argument exists, or no value exists for it. Otherwise, returns the value, converted to an int.
| Find an int value for a given argument. Returns iDefault if no such argument exists, or no value exists for it. Otherwise, returns the value, converted to an int.
|}
|}
[[Category:Scripting]]
[[Category:Scripting]]

Latest revision as of 20:47, 5 April 2025

CCommand is a container class that stores command arguments, typically those from console commands or game chat.

Type: Reference type.

Method Description
int ArgC() const Gets the number of arguments.
string GetCommandString() const Gets the entire command as a string.
string GetArgumentsString() const Gets all arguments as a single string.
string Arg(const int iIndex) const Gets the argument by index.
string opIndex(const int iIndex) const Gets the argument by index.
string FindArg(const string& in szArgument) const Find a value for a given argument. If the argument does not exist or has no value, an empty string is returned. Otherwise, returns the value.
int FindIntArg(const string& in szArgument, const int iDefault = 0) const Find an int value for a given argument. Returns iDefault if no such argument exists, or no value exists for it. Otherwise, returns the value, converted to an int.