Class CmdArgs
- Namespace
 - Vintagestory.API.Common
 
- Assembly
 - VintagestoryAPI.dll
 
The arguments from a client or sever command Open in GitHub
public class CmdArgs
  - Inheritance
 - 
      
      CmdArgs
 
- Inherited Members
 
- Extension Methods
 
Constructors
CmdArgs()
Creates a new instance of the CmdArgs util with no arguments
public CmdArgs()
  CmdArgs(string)
Creates a new instance of the CmdArgs util
public CmdArgs(string joinedargs)
  Parameters
joinedargsstring
CmdArgs(string[])
Creates a new instance of the CmdArgs util
public CmdArgs(string[] args)
  Parameters
argsstring[]
Properties
this[int]
Returns the n-th arugment
public string this[int index] { get; set; }
  Parameters
indexint
Property Value
Length
Amount of arguments passed
public int Length { get; }
  Property Value
Methods
AppendSingle(string)
Adds an arg to the end
public void AppendSingle(string arg)
  Parameters
argstring
Clone()
public CmdArgs Clone()
  Returns
PeekChar(char?)
Returns the first char of the first argument
public char? PeekChar(char? defaultValue = null)
  Parameters
defaultValuechar?
Returns
- char?
 
PeekWord(string)
Removes the first argument and returns it
public string PeekWord(string defaultValue = null)
  Parameters
defaultValuestring
Returns
PopAll()
Returns all remaining arguments as single merged string, concatenated with spaces
public string PopAll()
  Returns
PopBool(bool?, string)
Tries to retrieve arg at given index as boolean, or null if not enough arguments or not an integer
'true', 'yes' and '1' will all be interpreted as true.  Parameter trueAlias (with default value 'on') allows one additional word to be used to signify true.  Anything else will return false.
public bool? PopBool(bool? defaultValue = null, string trueAlias = "on")
  Parameters
Returns
- bool?
 
PopChar(char?)
Remove the first character from the first argument and returns it
public char? PopChar(char? defaultValue = null)
  Parameters
defaultValuechar?
Returns
- char?
 
PopCodeBlock(char, char, out string)
public string PopCodeBlock(char blockOpenChar, char blockCloseChar, out string parseErrorMsg)
  Parameters
Returns
PopDouble(double?)
Tries to retrieve arg at given index as int, or null if not enough arguments or not an integer
public double? PopDouble(double? defaultValue = null)
  Parameters
defaultValuedouble?
Returns
PopEnum<T>(T)
Tries to retrieve arg at given index as enum value or default if not enough arguments or not part of the enum
public T PopEnum<T>(T defaultValue = default)
  Parameters
defaultValueT
Returns
- T
 
Type Parameters
T
PopFlexiblePos(Vec3d, Vec3d)
Retrieves a player position with following syntax: [coord] [coord] [coord] whereas [coord] may be ~[decimal] or =[decimal] or [decimal] ~ denotes a position relative to the player = denotes an absolute position no prefix denots a position relative to the map middle
public Vec3d PopFlexiblePos(Vec3d playerPos, Vec3d mapMiddle)
  Parameters
Returns
PopFlexiblePos2D(Vec3d, Vec3d)
Retrieves a player position with following syntax: [coord] [coord] [coord] whereas [coord] may be ~[decimal] or =[decimal] or [decimal] ~ denotes a position relative to the player = denotes an absolute position no prefix denots a position relative to the map middle
public Vec2i PopFlexiblePos2D(Vec3d playerPos, Vec3d mapMiddle)
  Parameters
Returns
PopFloat(float?)
Tries to retrieve arg at given index as float, or null if not enough arguments or not a float
public float? PopFloat(float? defaultValue = null)
  Parameters
defaultValuefloat?
Returns
PopInt(int?)
Tries to retrieve arg at given index as int, or null if not enough arguments or not an integer
public int? PopInt(int? defaultValue = null)
  Parameters
defaultValueint?
Returns
- int?
 
PopLong(long?)
Tries to retrieve arg at given index as long, or null if not enough arguments or not a long
public long? PopLong(long? defaultValue = null)
  Parameters
defaultValuelong?
Returns
- long?
 
PopUntil(char)
public string PopUntil(char endChar)
  Parameters
endCharchar
Returns
PopVec3d(Vec3d)
public Vec3d PopVec3d(Vec3d defaultValue = null)
  Parameters
defaultValueVec3d
Returns
PopVec3i(Vec3i)
Tries to retrieve 3 int coordinates from the next 3 arguments
public Vec3i PopVec3i(Vec3i defaultValue = null)
  Parameters
defaultValueVec3i
Returns
PopWord(string)
Removes the first argument and returns it, scans until it encounters a white space
public string PopWord(string defaultValue = null)
  Parameters
defaultValuestring
Returns
Push(string)
public void Push(string joinedargs)
  Parameters
joinedargsstring
PushSingle(string)
Adds an arg to the beginning
public void PushSingle(string arg)
  Parameters
argstring