Sys

Sys (Class)

This class provides access to various base functions of system platforms. Look in the sys package for more system APIs.

Static Members

println(v: Dynamic): Void

Prints any value to the standard output, followed by a newline. On Windows, this function outputs a CRLF newline. LF newlines are printed on all other platforms.

Name Type
v Dynamic

args(): Array<String>

Returns all the arguments that were passed in the command line. This does not include the interpreter or the name of the program file.

(java)(eval) On Windows, non-ASCII Unicode arguments will not work correctly.

(cs) Non-ASCII Unicode arguments will not work correctly.

Returns
Array<String>

getEnv(s: String): String

Returns the value of the given environment variable, or null if it doesn't exist.

Name Type
s String
Returns
String

sleep(seconds: Float): Void

Suspends execution for the given length of time (in seconds).

Name Type
seconds Float

getCwd(): String

Gets the current working directory (usually the one in which the program was started).

Returns
String

setCwd(s: String): Void

Changes the current working directory.

(java) This functionality is not available on Java; calling this function will throw.

Name Type
s String

systemName(): String

Returns the type of the current system. Possible values are:

  • "Windows"
  • "Linux"
  • "BSD"
  • "Mac" | Returns | |---------| | String |

exit(code: Int): Void

Exits the current process with the given exit code.

(macro)(eval) Being invoked in a macro or eval context (e.g. with -x or --run) immediately terminates the compilation process, which also prevents the execution of any --next sections of compilation arguments.

Name Type
code Int

time(): Float

Gives the most precise timestamp value available (in seconds).

Returns
Float