The os
library is a standard Lua library. It is a global library and does not need to be imported.
Refer to the official Lua documentation for more details.
os.clock();
The os
library has been extended with some additional functions.
Sleep execution for time
milliseconds.
os.sleep(1000);
Open the specified file using the default program. If the path is a script or executable then it will execute it in a new window. On Windows it uses ShellExecute
internally.
os.open("C:\\file.txt");
It can also be used to open folder on your desktop.
os.open("C:\\foo\\");
Open all of the files using the default program in the specified folder (e.g. all music files in a folder).
os.openall("C:\\foo\\");
Start the process or program specified by command
. It fires and forgets, namely, it does not wait for the process to end nor does it capture the output or result code. For that, use the standard os.execute
function instead.
os.start("foobar.exe");
On Windows command
is also matched against installed applications.
os.start("spotify");
Arguments can also be passed:
os.start("ipconfig", "/all");
Alias for script.default.
os.script("echo \"foo\"");
Generates an error and stops the current action.
os.throw("something bad happened >.<");