Trial offers a number of functions to interact with the operating system facilities in a portable fashion. Since this is more of a toolkit kind of thing, here's a list of relevant functions:
Returns the runtime directory of the game, which is either the executable directory in deployed mode, or the system source directory in dev mode.
Returns a monotonic clock in seconds as a double float. The precision is implementation defined, but may very well be higher than internal-real-time.
Will open the given URL in a browser. This will also take care of using platform-specific browsers such as when Steam is used.
Will open the given path in a file manager.
Retrieve the directory described by an environment variable. May also return NIL if the variable is unset or empty.
Return a path to the local system's temporary directory. Files in here may be deleted when the application exits, or when the system restarts.
Return a path to a temporary file. Note: this function does not guarantee that the requested file does not already exist. Please use a loop over
path to a temporary file path according to
tempfile and ensures the file is deleted when body exits.
Returns the path to the central Trial log file, typically stored next to the executable unless the environment variable
TRIAL_LOGFILE is set.
Returns the path to the directory to use to store configuration and save files. This can be configured through the environment variable
AppData on Windows, and
XDG_CONFIG_HOME everywhere else. The path is dependent on the
Returns a descriptive name of the current user. This may be a human-readable display name of some sort, or their user account name. You may pass
T to fetch the answer without the context of a
A monotonically increasing count of bytes read or written by the process.
A monotonically increasing floating point number of seconds of CPU time spent by the process.
Returns two values: the number of kilobytes of free VRAM, and the total number of kilobytes of VRAM.
Returns two values: the number of kilobytes of free RAM, and the total number of kilobytes of RAM.
Try to prevent the system from entering powersave mode or activating the screensaver. You must regularly call
ping-powersave afterwards, and
restore-powersave once you're done.