Parameters | |
otlib | |
otlib. | The base parameter in the parameter system. |
BaseParam Variables | These variables help provide BaseParam’s meager feature set. |
Parse | Parses a string into the appropriate type for this parameter. |
IsValid | Checks if the given argument is valid within the context of what’s allowable. |
Autocomplete | Used to give autocomplete information for this parameter. |
ShortUsage | Used to give information about the usage on this parameter as concisely as possible. |
LongUsage | Used to give information about the usage on this parameter when screen space is not an issue. |
Default | Set the default value of this parameter. |
MinRepeats | Set the minimum number of times this argument must repeat. |
MaxRepeats | Set the maximum number of times this argument is allowed to repeat. |
TakesRestOfLine | Set the argument to take the rest of whatever arguments are available. |
GetDefault | Gets the default for this parameter. |
GetMinRepeats | Gets the min repeats for this parameter. |
GetMaxRepeats | Gets the max repeats for this parameter. |
GetTakesRestOfLine | Gets whether or not this parameter takes the rest of the line. |
ToString | Converts any options on this parameter that would be used for user permissions to a string that can be read in again later using FromString. |
FromString | Loads in user permissions from a string produced by ToString for this parameter. |
otlib. | The number parameter. |
Parse | See otlib.BaseParam.Parse. |
IsValid | See otlib.BaseParam.IsValid. |
Autocomplete | See otlib.BaseParam.Autocomplete. |
Min | Sets the minimum number for this argument. |
Max | Sets the maximum number for this argument. |
RoundTo | Sets what to round this argument too during Parse. |
ToString | See otlib.BaseParam.ToString. |
FromString | See otlib.BaseParam.FromString and ToString. |
The base parameter in the parameter system. Provides skeleton functions and the behavior for optional and default arguments.
BaseParam Variables | These variables help provide BaseParam’s meager feature set. |
Parse | Parses a string into the appropriate type for this parameter. |
IsValid | Checks if the given argument is valid within the context of what’s allowable. |
Autocomplete | Used to give autocomplete information for this parameter. |
ShortUsage | Used to give information about the usage on this parameter as concisely as possible. |
LongUsage | Used to give information about the usage on this parameter when screen space is not an issue. |
Default | Set the default value of this parameter. |
MinRepeats | Set the minimum number of times this argument must repeat. |
MaxRepeats | Set the maximum number of times this argument is allowed to repeat. |
TakesRestOfLine | Set the argument to take the rest of whatever arguments are available. |
GetDefault | Gets the default for this parameter. |
GetMinRepeats | Gets the min repeats for this parameter. |
GetMaxRepeats | Gets the max repeats for this parameter. |
GetTakesRestOfLine | Gets whether or not this parameter takes the rest of the line. |
ToString | Converts any options on this parameter that would be used for user permissions to a string that can be read in again later using FromString. |
FromString | Loads in user permissions from a string produced by ToString for this parameter. |
These variables help provide BaseParam’s meager feature set. Feel free to read these values if you need to, but you should modify them through their appropriate functions, Default, MinRepeats, and MaxRepeats.
default | A variable of any type specifying the value to use if the parameter is optional (min repeats is 0) and left unspecified. Defaults to nil. |
max_repeats | The maximum number of times this parameter is allowed to repeat. Defaults to 1. |
min_repeats | The minimum number of times this parameter must repeat. Defaults to 1. If set to 0 (via MinRepeats), this parameter becomes optional and default will be used if the parameter is left unspecified. |
function BaseParam:Parse( user, arg )
Parses a string into the appropriate type for this parameter. All parameter implementations should be sure to call the BaseParam implementation, since it defines some necessary behavior.
user | The otlib.group object that we’re running on behalf of. |
arg | The value of any type to parse from. |
The parsed argument of any type (but will be a type specific to each parameter type).
v1.00 | Initial. |
function BaseParam:IsValid( user, arg )
Checks if the given argument is valid within the context of what’s allowable. All parameter implementations should be sure to call the BaseParam implementation, since it defines some necessary behavior.
user | The otlib.group object that we’re running on behalf of. |
arg | The argument of any type to validate (but the types will be specific to each parameter type). |
1 | A boolean that’s true if the user can use this parameter in this context, false otherwise. |
2 | Nil if the above return is true, an otlib.InvalidCondition object explaining why they don’t have access otherwise. |
v1.00 | Initial. |
function BaseParam:Autocomplete( user, str )
Used to give autocomplete information for this parameter. This function should be overridden in each parameter implementation, since the BaseParam version throws an error.
user | The otlib.group object that we’re running on behalf of. |
str | A string that represents a partial argument. Will probably need to go through a special form of parsing to be useful (IE, get all players whose names contain str for a player parameter). |
Nil or a list table of options the user has to autocomplete this parameter with. Nil is returned when the list of completes is too large or when it just doesn’t make sense to have autocompletion.
v1.00 | Initial. |
function BaseParam:ShortUsage( user )
Used to give information about the usage on this parameter as concisely as possible. This function should be overridden in each parameter implementation, since the BaseParam version throws an error.
user | The otlib.group object that we’re running on behalf of. |
A concise string explaining this parameter usage.
v1.00 | Initial. |
function BaseParam:LongUsage( user )
Used to give information about the usage on this parameter when screen space is not an issue. This function should be overridden in each parameter implementation, since the BaseParam version throws an error.
user | The otlib.group object that we’re running on behalf of. |
A string explaining this parameter usage.
v1.00 | Initial. |
function BaseParam:MinRepeats( min_repeats )
Set the minimum number of times this argument must repeat. See min_repeats.
A repeating parameter (min repeats > 1) MUST be the last parameter in an access.
min_repeats | The number of times to repeat, at minimum. |
Self.
v1.00 | Initial. |
function BaseParam:MaxRepeats( max_repeats )
Set the maximum number of times this argument is allowed to repeat. See max_repeats.
A repeating parameter (max repeats > 1) MUST be the last parameter in an access.
max_repeats | The number of times to repeat, at maximum. |
Self.
v1.00 | Initial. |
function BaseParam:TakesRestOfLine( takes_rest_of_line )
Set the argument to take the rest of whatever arguments are available. Really only useful for a <otlib.StringParam>, but defined here anyways just in case.
A parameter that takes the rest of the line MUST be the last parameter in an access and cannot be a repeating parameter.
takes_rest_of_line | The boolean stating whether or not the argument takes the rest of argument line. |
Self.
v1.00 | Initial. |
function BaseParam:GetDefault()
Gets the default for this parameter. See Default.
The variable of any type that represents the default.
v1.00 | Initial. |
function BaseParam:GetMinRepeats()
Gets the min repeats for this parameter. See MinRepeats.
The number of minimum repititions for this parameter.
v1.00 | Initial. |
function BaseParam:GetMaxRepeats()
Gets the max repeats for this parameter. See MaxRepeats.
The number of maximum repititions for this parameter.
v1.00 | Initial. |
function BaseParam:GetTakesRestOfLine()
Gets whether or not this parameter takes the rest of the line. See TakesRestOfLine.
The boolean stating whether or not this argument takes the rest of the line.
v1.00 | Initial. |
function BaseParam:ToString()
Converts any options on this parameter that would be used for user permissions to a string that can be read in again later using FromString. IE, you’d use this function to save permissions.
The serialized permission string. Implementations return “*” if anything is allowed.
v1.00 | Initial. |
function BaseParam:FromString( str )
Loads in user permissions from a string produced by ToString for this parameter.
Self.
v1.00 | Initial. |
The number parameter. Provides a way to read in numbers from the user.
Parse | See otlib.BaseParam.Parse. |
IsValid | See otlib.BaseParam.IsValid. |
Autocomplete | See otlib.BaseParam.Autocomplete. |
Min | Sets the minimum number for this argument. |
Max | Sets the maximum number for this argument. |
RoundTo | Sets what to round this argument too during Parse. |
ToString | See otlib.BaseParam.ToString. |
FromString | See otlib.BaseParam.FromString and ToString. |
function NumParam:RoundTo( round_to )
Sets what to round this argument too during Parse.
round_to | The number of the place to round this number to (see <otlib.Round>) or nil. If nil, no rounding is performed, which is the default behavior. |
Self.
v1.00 | Initial. |
Parses a string into the appropriate type for this parameter.
function BaseParam:Parse( user, arg )
Checks if the given argument is valid within the context of what’s allowable.
function BaseParam:IsValid( user, arg )
Used to give autocomplete information for this parameter.
function BaseParam:Autocomplete( user, str )
Used to give information about the usage on this parameter as concisely as possible.
function BaseParam:ShortUsage( user )
Used to give information about the usage on this parameter when screen space is not an issue.
function BaseParam:LongUsage( user )
Set the default value of this parameter.
function BaseParam:Default( default )
Set the minimum number of times this argument must repeat.
function BaseParam:MinRepeats( min_repeats )
Set the maximum number of times this argument is allowed to repeat.
function BaseParam:MaxRepeats( max_repeats )
Set the argument to take the rest of whatever arguments are available.
function BaseParam:TakesRestOfLine( takes_rest_of_line )
Gets the default for this parameter.
function BaseParam:GetDefault()
Gets the min repeats for this parameter.
function BaseParam:GetMinRepeats()
Gets the max repeats for this parameter.
function BaseParam:GetMaxRepeats()
Gets whether or not this parameter takes the rest of the line.
function BaseParam:GetTakesRestOfLine()
Converts any options on this parameter that would be used for user permissions to a string that can be read in again later using FromString.
function BaseParam:ToString()
Loads in user permissions from a string produced by ToString for this parameter.
function BaseParam:FromString( str )
See otlib.BaseParam.Parse.
function NumParam:Parse( user, arg )
See otlib.BaseParam.IsValid.
function NumParam:IsValid( user, arg )
See otlib.BaseParam.Autocomplete.
function NumParam:Autocomplete( user, cmd, arg )
Sets the minimum number for this argument.
function NumParam:Min( min )
Sets the maximum number for this argument.
function NumParam:Max( max )
Sets what to round this argument too during Parse.
function NumParam:RoundTo( round_to )
See otlib.BaseParam.ToString.
function NumParam:ToString()
See otlib.BaseParam.FromString and ToString.
function NumParam:FromString( str )