HsLua.Module.System

hslua-module-system-1.1.2: Lua module wrapper around Haskell's System module.

Copyright | © 2019-2024 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <tarleb@hslua.org>
Stability | alpha
Portability | Requires GHC 8 or later.
Safe Haskell | None
Language | Haskell2010

HsLua.Module.System

Contents

- Module
  - Fields
  - Functions

Description

Provide a Lua module containing a selection of ``System`` functions.

Synopsis

- documentedModule :: LuaError e => Module e
- arch :: Field e
- compiler_name :: Field e
- compiler_version :: LuaError e => Field e
- os :: Field e
- cputime :: LuaError e => DocumentedFunction e
- env :: LuaError e => DocumentedFunction e
- getenv :: LuaError e => DocumentedFunction e
- getwd :: LuaError e => DocumentedFunction e
- ls :: LuaError e => DocumentedFunction e
- mkdir :: LuaError e => DocumentedFunction e
- rmdir :: LuaError e => DocumentedFunction e
- setenv :: LuaError e => DocumentedFunction e
- setwd :: LuaError e => DocumentedFunction e
- tmpdirname :: LuaError e => DocumentedFunction e
- with_env :: LuaError e => DocumentedFunction e
- with_tmpdir :: LuaError e => DocumentedFunction e
- with_wd :: LuaError e => DocumentedFunction e

# Module

documentedModule :: LuaError e => Module e #

The "system" module.

## Fields

arch :: Field e #

Module field containing the machine architecture on which the program is running. Wraps ``arch``

compiler_name :: Field e #

Module field containing the Haskell implementation with which the host program was compiled. Wraps ``compilerName``.

compiler_version :: LuaError e => Field e #

Module field containing the version of `compiler_name` with which the host program was compiled.

os :: Field e #

Field containing the operating system on which the program is running.

## Functions

cputime :: LuaError e => DocumentedFunction e #

Access the CPU time, e.g. for benchmarking.

env :: LuaError e => DocumentedFunction e #

Retrieve the entire environment

getenv :: LuaError e => DocumentedFunction e #

Returns the value of an environment variable

getwd :: LuaError e => DocumentedFunction e #

Return the current working directory as an absolute path.

ls :: LuaError e => DocumentedFunction e #

List the contents of a directory.

mkdir :: LuaError e => DocumentedFunction e #

Create a new directory which is initially empty, or as near to empty as the operating system allows.

If the optional second parameter is `false`, then create the new directory only if it doesn't exist yet. If the parameter is `true`, then parent directories are created as necessary.

rmdir :: LuaError e => DocumentedFunction e #

Remove an existing directory.

setenv :: LuaError e => DocumentedFunction e #

Set the specified environment variable to a new value.

setwd :: LuaError e => DocumentedFunction e #

Change current working directory.

tmpdirname :: LuaError e => DocumentedFunction e #

Get the current directory for temporary files.

with_env :: LuaError e => DocumentedFunction e #

Run an action, then restore the old environment variable values.

with_tmpdir :: LuaError e => DocumentedFunction e #

with_wd :: LuaError e => DocumentedFunction e #

Run an action in a different directory, then restore the old working directory.