Module jls.lang.system

Provides access to data and operations of the underlying OS.

Access to environnement variables and default standard file handles. Operation such as the exit method and the garbage collection.

Functions

system.currentTime () Returns the current time in seconds.
system.currentTimeMillis () Returns the current time in milliseconds.
system.sleep (millis) Causes the program to sleep.
system.getenv (name) Gets a specific environnement property.
system.createArgumentTable ([options[, arguments]]) Returns a table containing an entry for each argument name, see jls.util.tables.
system.getArguments () Returns the arguments used when calling the Lua standalone executable.
system.exec (command, env, dir) Executes the specified command and arguments in a separate process with the specified environment and working directory.
system.execute (command[, anyCode[, callback]]) Executes the specified command line in a separate thread.
system.findExecutablePath (name) Returns the executable path based on the PATH environment variable.
system.exit (code) Terminates the program and returns a value to the OS.
system.gc () Runs the garbage collector.
system.halt (code) Forcibly terminates the program and returns a value to the OS.

Fields

system.lineSeparator The Operating System (OS) line separator, '\n' on Unix and '\r\n' on Windows.
system.input The standard input stream file descriptor.
system.output The standard output stream file descriptor.
system.error The standard error stream file descriptor.


Functions

system.currentTime ()
Returns the current time in seconds. The time is given as the number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

Returns:

    The current time in seconds
system.currentTimeMillis ()
Returns the current time in milliseconds.

Returns:

    The current time in milliseconds
system.sleep (millis)
Causes the program to sleep.

Parameters:

  • millis The length of time to sleep in milliseconds
system.getenv (name)
Gets a specific environnement property.

Parameters:

  • name The name of the property to get

Returns:

    The environnement property
system.createArgumentTable ([options[, arguments]])
Returns a table containing an entry for each argument name, see jls.util.tables.

Parameters:

  • options table The options (optional)
  • arguments string The command line containing the arguments (optional)

Returns:

    table The arguments as a table
system.getArguments ()
Returns the arguments used when calling the Lua standalone executable.

Returns:

    table The arguments
system.exec (command, env, dir)
Executes the specified command and arguments in a separate process with the specified environment and working directory.

Parameters:

  • command Array of strings specifying the command-line arguments. The first argument is the name of the executable file.
  • env Array of key=values specifying the environment strings. If undefined, the new process inherits the environment of the parent process.
  • dir The working directory of the subprocess, or undefined if the subprocess should inherit the working directory of the current process

Returns:

    jls.lang.ProcessHandle A handle of the new process
system.execute (command[, anyCode[, callback]])
Executes the specified command line in a separate thread. The promise will be rejected if the process exit code is not zero. The error is a table with a code and a kind fields.

Parameters:

  • command string The command-line to execute
  • anyCode boolean true to resolve the promise with any exit code (optional)
  • callback function An optional callback function to use in place of promise (optional)

Returns:

    jls.lang.Promise A promise that resolves once the command has been executed
system.findExecutablePath (name)
Returns the executable path based on the PATH environment variable.

Parameters:

  • name string The executable name, without the extension .exe

Returns:

    string The executable path or nil
system.exit (code)
Terminates the program and returns a value to the OS.

Parameters:

  • code The exit code to return to the OS
system.gc ()
Runs the garbage collector.
system.halt (code)
Forcibly terminates the program and returns a value to the OS.

Parameters:

  • code The exit code to return to the OS

Fields

system.lineSeparator
The Operating System (OS) line separator, '\n' on Unix and '\r\n' on Windows.
system.input
The standard input stream file descriptor.
system.output
The standard output stream file descriptor.
system.error
The standard error stream file descriptor.
generated by LDoc 1.4.6