6.9 – Operating System Facilities
This library is implemented through table os.
os
os.setlocale (locale [, category]) Sets the current locale of the program. locale is a system-dependent string specifying a locale; category is an optional
os.getenv (varname) Returns the value of the process environment variable varname, or nil if the variable is not defined.
os.tmpname () Returns a string with a file name that can be used for a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer
os.exit ([code [, close]]) Calls the ISO C function exit to terminate the host program. If code is true, the returned status is EXIT_SUCCESS;
os.time ([table]) Returns the current time when called without arguments, or a time representing the local date and time specified by the given table. This table must have fields
os.rename (oldname, newname) Renames the file or directory named oldname to newname. If this function fails, it returns nil, plus a string describing
os.execute ([command]) This function is equivalent to the ISO C function system. It passes command to be executed by an operating system shell. Its first
os.remove (filename) Deletes the file (or empty directory, on POSIX systems) with the given name. If this function fails, it returns nil, plus a string describing the error
os.date ([format [, time]]) Returns a string or a table containing date and time, formatted according to the given string format. If the time
os.clock () Returns an approximation of the amount in seconds of CPU time used by the program.
Page 1 of 2