Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (59 sloc) 1.86 KB

OS

os

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();

extensions

The os library has been extended with some additional functions.

os.sleep( time )

Sleep execution for time milliseconds.

os.sleep(1000);

os.open( path, [args] )

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\\");

os.openall( path )

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\\");

os.start( command, [arg1], [arg2], [...] )

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");

os.script( script )

Alias for script.default.

os.script("echo \"foo\"");

os.throw( message )

Generates an error and stops the current action.

os.throw("something bad happened >.<");