Skip to content

os

This content is for v0.2.1. Switch to the latest version for up-to-date documentation.

The os namespace provides metadata about the underlying host platform and operating system.


FunctionSignatureReturn TypeDescription
os.platformos.platform()stringReturns host OS name ("windows", "linux", "macos").
os.archos.arch()stringReturns processor architecture ("x86_64", "arm64").
os.hostnameos.hostname()stringReturns computer network name.
os.homediros.homedir()stringReturns current user home directory.

print("Running on: " + os.platform());
print("Architecture: " + os.arch());
print("Host: " + os.hostname());
if (os.platform() == "windows") {
print("Windows specific initialization...");
} else {
print("POSIX initialization...");
}