Scaleform Studio Lua API Reference: os namespace reference
Operating System namespace - Provides functions for dealing with system time and date and other OS-related functions.
|
Returns an approximation of the amount in seconds of CPU time used by the program.
|
Parameters | This function does not accept any parameters. |
Returns number |
The CPU time in seconds.
|
|
Returns an approximation of the amount in seconds of CPU time used by the program.
|
Parameters | This function does not accept any parameters. |
Returns number |
The CPU time in seconds.
|
|
date ( format, time ) : any(string,table)
Returns a string or a table containing date and time, formatted according to the given string format.
|
Parameters format : | string? |
If format starts with '!', then the date is formatted in Coordinated Universal Time. After this optional character, if format
is the string "t", then *date returns a table with the following fields: year (four digits), month (1--12), day (1--31), hour (0--23),
min (0--59), sec (0--61), wday (weekday, Sunday is 1), yday (day of the year), and isdst (daylight saving flag, a boolean).
If format is not "t", then *date returns the date as a string, formatted according to the same rules as the C function strftime.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
time : | number? |
If the time argument is present, this is the time to be formatted (see the os.time). Otherwise, date formats the current time.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns any(string,table) |
A string or table containing the date and time.
The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
When called without arguments, date returns a reasonable
date and time representation that depends on the host system and on the current locale (that is, os.date() is equivalent to os.date("c")).
|
Returns the number of seconds from time t1 to time t2.
|
Parameters t1 : | number |
The first time parameter (in t2-t1).
|
t2 : | number |
The second time parameter (in t2-t1).
|
Returns number |
The difference in time.
|
In POSIX, Windows, and some other systems, this value is exactly t2-t1.
|
Passes a command to be executed by an operating system shell.
|
Parameters cmd : | string |
A string specifying a command to be executed by an operating system shell. The function of this command depends on what is allowed by the running OS.
If cmd is not specified, the return value is nonzero if a shell is available, and zero otherwise
|
Returns number |
A status code which is sytem dependent.
|
This function is equivalent to the C function system.
|
Calls the C function exit, with an optional code, to terminate the host program.
|
Parameters exit : | number? |
An argument that returns the exit code to the operating system. Default value is the success code.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns | This function does not return any values. |
|
Returns the value of the process environment variable, or nil if the variable is not defined.
|
Parameters varname : | string |
The process environment variable.
|
Returns number |
The value of the environment variable.
|
|
remove ( filename ) : boolean, string
Deletes the file or directory with the given name.
|
Parameters filename : | string |
The name of the file or directory to remove.
|
Returns boolean |
Returns true if the file is deleted successfully and false otherwise.
|
string |
If the function fails, this returns a string with reason for failure.
|
Directories must be empty to be removed. If this function fails, it returns nil, plus a string describing the error.
|
rename ( old_name, new_name ) : nil, string
Renames a file or directory.
|
Parameters old_name : | string |
The name of the file/directory to rename.
|
new_name : | string |
The new name for the file/directory.
|
Returns string |
If the function fails, this returns a string with reason for failure.
|
If this function fails, it returns nil, plus a string describing the error.
|
rename ( old_name, new_name ) : boolean, string
Renames a file or directory.
|
Parameters old_name : | string |
The name of the file/directory to rename.
|
new_name : | string |
The new name for the file/directory.
|
Returns boolean |
Returns true if the file is renamed successfully and false otherwise.
|
string |
If the function fails, this returns a string with reason for failure.
|
If this function fails, it returns nil, plus a string describing the error.
|
Sets the current locale of the program.
|
Parameters locale : | string |
The locale.
|
category : | string? |
An string describing which category to change: "all", "collate", "ctype", "monetary", "numeric", or "time";
the default category is "all".
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns string |
The name of the new locale of the program.
|
The function returns the name of the new locale, or nil if the request cannot be honored.
If locale is the empty string, the current locale is set to an implementation-defined native locale. If locale is the string "C",
the current locale is set to the standard C locale.
When called with nil as the first argument, this function only returns the name of the current locale for the given category.
|
time ( time ) : number
Returns the current time when called without arguments, or a time representing the date and time specified by the given table.
|
Parameters time : | table? |
A table specifying a time to convert to seconds. This table must have fields year, month, and day, and may have
fields hour, min, sec, and isdst(for a description of these fields, see the os.date function).
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns
|
Returns a string with a file name that can be used for a temporary file.
|
Parameters | This function does not accept any parameters. |
Returns string |
The name of the temporary file.
|
The file must be explicitly opened before its use and explicitly removed when no longer needed.
When possible, you may prefer to use io.tmpfile, which automatically removes the file when the program ends.
os.clock () : number
Returns an approximation of the amount in seconds of CPU time used by the program.
number
The CPU time in seconds.A numeric value.
number
The CPU time in seconds.
os.date (format, time) : any(string,table)
Returns a string or a table containing date and time, formatted according to the given string format.
format : string?
If format starts with '!', then the date is formatted in Coordinated Universal Time. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
time : number?
If the time argument is present, this is the time to be formatted (see the os.time). [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
any(string,table)
A string or table containing the date and time.The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
A string of characters.A Lua table consisting of paired keys and values.
os.time (time) : number
Returns the current time when called without arguments, or a time representing the date and time specified by the given table.
os.difftime (t1, t2) : number
Returns the number of seconds from time t1 to time t2.
t1 : number
The first time parameter (in t2-t1).
t2 : number
The second time parameter (in t2-t1).
number
The difference in time.
os.execute (cmd) : number
Passes a command to be executed by an operating system shell.
cmd : string
A string specifying a command to be executed by an operating system shell. [more...]
number
A status code which is sytem dependent.
os.exit (exit)
Calls the C function exit, with an optional code, to terminate the host program.
exit : number?
An argument that returns the exit code to the operating system. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
os.getenv (varname) : number
Returns the value of the process environment variable, or nil if the variable is not defined.
varname : string
The process environment variable.
number
The value of the environment variable.
os.remove (filename) : boolean, string
Deletes the file or directory with the given name.
filename : string
The name of the file or directory to remove.
boolean
Returns true if the file is deleted successfully and false otherwise.
string
If the function fails, this returns a string with reason for failure.true or false.
os.rename (old_name, new_name) : nil, string
Renames a file or directory.
old_name : string
The name of the file/directory to rename.
new_name : string
The new name for the file/directory.
nil
string
If the function fails, this returns a string with reason for failure.
os.rename (old_name, new_name) : boolean, string
Renames a file or directory.
old_name : string
The name of the file/directory to rename.
new_name : string
The new name for the file/directory.
boolean
Returns true if the file is renamed successfully and false otherwise.
string
If the function fails, this returns a string with reason for failure.
os.setlocale (locale, category) : string, nil
Sets the current locale of the program.
locale : string
The locale.
category : string?
An string describing which category to change: "all", "collate", "ctype", "monetary", "numeric", or "time"; the default category is "all".The ? notation indicates that this type is optional: there may be zero or one instances of it.
string
The name of the new locale of the program.
nil
time : table?
A table specifying a time to convert to seconds. [more...]The ? notation indicates that this type is optional: there may be zero or one instances of it.
number
The current time.
os.tmpname () : string
Returns a string with a file name that can be used for a temporary file.
string
The name of the temporary file.
io.tmpfile () : string
Returns a handle for a temporary file.
Nothing; the absence of a value.
string
A file handle to the temporary file opened for reading and writing.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.