Scaleform Studio Lua API Reference: string namespace reference
String namespace
|
byte ( s, i, j ) : any*
Returns the internal numerical codes of the characters in the string.
|
Parameters s : | string |
The string.
|
i : | integer? |
The characters in the string s[i], s[i+1], ..., s[j] for which numeric code is returned. Default value of 1.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
j : | integer? |
The characters in the string s[i], s[i+1], ..., s[j] for which codes are returned. Default value of 1.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns any* |
The codes for the characters in the string.
The * notation indicates that there may be zero or more instances of the specified type. |
|
char ( arg1 ) : string
Returns a string with the length equal to the number of arguments passed.
|
Parameters arg1 : | integer* |
Zero or more integers representing numeric codes.
The * notation indicates that there may be zero or more instances of the specified type. |
Returns string |
A string with the length equal to the number of arguments, where each character has the internal numerical code equal to its corresponding argument.
|
|
Returns a string containing a binary representation of the given function, so that a later loadstring on this string returns a copy of the function.
|
Parameters f : | fun(any*:any*) |
A Lua function with no upvalues.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
Returns string |
A string containing the binary representation of the function.
|
|
find ( s, pattern, init, plain ) : integer*, nil
Looks for the first match of pattern in the string.
|
Parameters s : | string |
The string to be searched.
|
pattern : | string |
A string specifing the pattern to match.
|
init : | number |
Specifies where to start the search. Default value of 1, can be negative. Negative numbers start at the end of the string.
|
plain : | boolean |
A boolean flag that determines whether to turn off the pattern matching facilities, so the function does a plain "find substring" operation, with
no characters in pattern being considered "magic". Note that if plain is given, then init must be given as well.
|
Returns integer* |
The indices of the string s, where the match starts and ends, if a match is found in the string.
The * notation indicates that there may be zero or more instances of the specified type. |
If it finds a match, then find returns the indices of s where this occurrence starts and ends; otherwise, it returns nil.
Parameters formatstring : | string |
The string to be formatted.
|
options : | any* |
The format specifiers that follows the same rules as the printf family of standard C functions. The only differences are that the options/modifiers *, l, L, n, p,
and h are not supported and that there is an extra option, q. The q option formats a string in a form suitable to be safely read back by the Lua interpreter: the string
is written between double quotes, and all double quotes, newlines, embedded zeros, and backslashes in the string are correctly escaped when written. The options
c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument, whereas q and s expect a string. This function does not accept string values
containing embedded zeros, except as arguments to the q option.
The * notation indicates that there may be zero or more instances of the specified type. |
Returns string |
The formatted string.
|
|
gmatch ( s, pattern ) : fun(any*:any*)
Returns a pattern finding iterator.
|
Parameters s : | string |
The string to search.
|
pattern : | string |
The string to match.
|
Returns fun(any*:any*) |
The iterator function.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
The iterator will search through the string looking for instances of the pattern passed.
|
gsub ( s, pattern, repl, n ) : string, integer
Returns a modified string where all occurences of a pattern in the string are replaced by "repl" string.
|
Parameters s : | string |
The string to search.
|
pattern : | string |
The string specifing the pattern to match.
|
repl : | string |
The replacement value for the string. This can be a string, a table, or a function.
If repl is a string, then its value is used for replacement. The character % works as an escape character: any sequence in repl of the form n, with n between 1 and 9,
stands for the value of the n-th captured substring (see below). The sequence %0 stands for the whole match. The sequence %% stands for a single %.
If repl is a table, then the table is queried for every match, using the first capture as the key; if the pattern specifies no captures, then the whole match is used as the key.
If repl is a function, then this function is called every time a match occurs, with all captured substrings passed as arguments, in order; if the pattern specifies no captures,
then the whole match is passed as a sole argument.
If the value returned by the table query or by the function call is a string or a number, then it is used as the replacement string; otherwise, if it is false or nil, then there is
no replacement (that is, the original match is kept in the string).
|
n : | integer? |
Number of occurences of the pattern to replace.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns string |
The modified string.
|
integer |
The number of substitutions made.
|
|
len ( s ) : integer
Returns the length of the string.
|
Parameters s : | string |
The string whose length is returned.
|
Returns integer |
The length of the string.
|
An empty string "" has length 0. Embedded zeros are counted, so "a\000bc\000" has length 5.
|
Returns a string with all its uppercase characters changed to lowercase.
|
Parameters s : | string |
The string whose uppercase are converted
|
Returns string |
The string with all uppercase changed to lowercase.
|
All other characters are left unchanged. The definition of an uppercase depends on the current locale.
|
match ( s, pattern, init ) : string
Looks for first match of the specified pattern in a string.
|
Parameters s : | string |
The string to search.
|
pattern : | string |
The string to match.
|
init : | number? |
Specifies where to start the search. Default value of 1, can be negative. Negative numbers start at the end of the string.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns string |
A substring matching the pattern specified.
|
If a match is found, the function returns the captures from the pattern; otherwise it returns nil. If pattern specifies no
captures, then the whole match is returned.
|
rep ( s, n ) : string
Replicates a string that is the concatenation of n copies of the string s.
|
Parameters s : | string |
The string to replicate.
|
n : | integer |
Number of times to replicate.
|
Returns string |
A concatenated string with n copies of the string.
|
|
Reverses a string.
|
Parameters s : | string |
The string to reverse.
|
Returns string |
A reversed string.
|
|
sub ( s, i, j ) : string
Returns a substring of an existing string.
|
Parameters s : | string |
The string
|
i : | number |
The index to start of the substring (character position).
|
j : | number? |
The index to end of the substring. If not specified, the substring ends at the end of string.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns
|
Returns a string with all its lowercase characters changed to uppercase.
|
Parameters s : | string |
The string whose lowercase are converted.
|
Returns string |
The string with all lowercase changed to uppercase.
|
All other characters are left unchanged. The definition of an lowercase depends on the current locale.
string.byte (s, i, j) : any*
Returns the internal numerical codes of the characters in the string.
s : string
The string.
i : integer?
The characters in the string s[i], s[i+1], ..., s[j] for which numeric code is returned. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
j : integer?
The characters in the string s[i], s[i+1], ..., s[j] for which codes are returned. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
any*
The codes for the characters in the string.The * notation indicates that there may be zero or more instances of the specified type.
A string of characters.A strictly integral numeric value, with no decimal component.This value may be an instance of any type.
string.char (arg1) : string
Returns a string with the length equal to the number of arguments passed.
arg1 : integer*
Zero or more integers representing numeric codes.The * notation indicates that there may be zero or more instances of the specified type.
string
A string with the length equal to the number of arguments, where each character has the internal numerical code equal to its corresponding argument.
string.dump (f) : string
Returns a string containing a binary representation of the given function, so that a later loadstring on this string returns a copy of the function.
f : fun(any*:any*)
A Lua function with no upvalues.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
string
A string containing the binary representation of the function.
loadstring (stringarg, chunkname) : fun(any:any), nil, string
Loads the string, parses it and returns the compiled chunk as a function.
string.find (s, pattern, init, plain) : integer*, nil
Looks for the first match of pattern in the string.
s : string
The string to be searched.
pattern : string
A string specifing the pattern to match.
init : number
Specifies where to start the search. [more...]
plain : boolean
A boolean flag that determines whether to turn off the pattern matching facilities, so the function does a plain "find substring" operation, with no characters in pattern being considered "magic". [more...]
integer*
The indices of the string s, where the match starts and ends, if a match is found in the string.The * notation indicates that there may be zero or more instances of the specified type.
nilA numeric value.true or false.
string.format (formatstring, options) : string
Returns a string formatted using the given format options.
formatstring : string
The string to be formatted.
options : any*
The format specifiers that follows the same rules as the printf family of standard C functions. [more...]The * notation indicates that there may be zero or more instances of the specified type.
string
The formatted string.
string.gmatch (s, pattern) : fun(any*:any*)
Returns a pattern finding iterator.
s : string
The string to search.
pattern : string
The string to match.
fun(any*:any*)
The iterator function.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
string.gsub (s, pattern, repl, n) : string, integer
Returns a modified string where all occurences of a pattern in the string are replaced by "repl" string.
s : string
The string to search.
pattern : string
The string specifing the pattern to match.
repl : string
The replacement value for the string. [more...]
n : integer?
Number of occurences of the pattern to replace.The ? notation indicates that this type is optional: there may be zero or one instances of it.
string
The modified string.
integer
The number of substitutions made.
string.len (s) : integer
Returns the length of the string.
s : string
The string whose length is returned.
integer
The length of the string.
string.lower (s) : string
Returns a string with all its uppercase characters changed to lowercase.
s : string
The string whose uppercase are converted
string
The string with all uppercase changed to lowercase.
string.match (s, pattern, init) : string
Looks for first match of the specified pattern in a string.
s : string
The string to search.
pattern : string
The string to match.
init : number?
Specifies where to start the search. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
string
A substring matching the pattern specified.
string.rep (s, n) : string
Replicates a string that is the concatenation of n copies of the string s.
s : string
The string to replicate.
n : integer
Number of times to replicate.
string
A concatenated string with n copies of the string.
string.reverse (s) : string
Reverses a string.
s : string
The string to reverse.
string
A reversed string.
string.sub (s, i, j) : string
Returns a substring of an existing string.
s : string
The string
i : number
The index to start of the substring (character position).
j : number?
The index to end of the substring. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
string
A substring.
string.upper (s) : string
Returns a string with all its lowercase characters changed to uppercase.
s : string
The string whose lowercase are converted.
string
The string with all lowercase changed to uppercase.
stringarg : string
The string to load.
chunkname : string?
The chunk to load.The ? notation indicates that this type is optional: there may be zero or one instances of it.
fun(any:any)
Returns the compiled chunk, if the operation was successful.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
nil
string
The error message for failure.Nothing; the absence of a value.Indicates a table.
This documentation uses the term table to mean an anonymous, temporary Lua table that contains named data values. You typically use these tables to pass data or settings to a function, or to hold data returned by a function.Indicates an object.
This documentation uses the term object to mean a named Lua table or userdata value that maintains a state. Some object types may have multiple instances existing at the same time, each with its own state; these objects typically have creation functions or accessors that you must call in order to get an instance. Some object types have only one instance, which you always access through the object's name.Indicates a named variable within a namespace, object or table; or an element within an enumeration.Indicates a code sample.Indicates an enumeration.
This documentation uses the term enumeration to mean a named Lua table that contains only a set of constant values. These values typically identify a predefined set of options for some setting or behavior. You might pass an enumeration value to a function, or test the value returned by a function against the items in the enumeration to see which option is currently set.Indicates a named variable within a namespace or object that has a pre-set constant value.Indicates a category: a semantic grouping of related API elements.Indicates a namespace.
This documentation uses the term namespace to mean a named Lua table that exists in only one single instance, intended as a container for an interface of related objects, functions and data variables.Indicates an output value returned by a function.Indicates a named function within a namespace or object.Indicates an input parameter for a function.