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

Copyright | © 2019-2026 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
- cmd :: LuaError e => DocumentedFunction e
- cp :: LuaError e => DocumentedFunction e
- cputime :: LuaError e => DocumentedFunction e
- env :: LuaError e => DocumentedFunction e
- exists :: LuaError e => DocumentedFunction e
- getenv :: LuaError e => DocumentedFunction e
- getwd :: LuaError e => DocumentedFunction e
- ls :: LuaError e => DocumentedFunction e
- mkdir :: LuaError e => DocumentedFunction e
- read_file :: LuaError e => DocumentedFunction e
- rename :: LuaError e => DocumentedFunction e
- rm :: LuaError e => DocumentedFunction e
- rmdir :: LuaError e => DocumentedFunction e
- setenv :: LuaError e => DocumentedFunction e
- setwd :: LuaError e => DocumentedFunction e
- times :: 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
- write_file :: LuaError e => DocumentedFunction e
- xdg :: LuaError e => DocumentedFunction e

# Module

documentedModule :: LuaError e => Module e Source #

The "system" module.

## Fields

arch :: Field e Source #

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

compiler_name :: Field e Source #

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

compiler_version :: LuaError e => Field e Source #

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

os :: Field e Source #

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

## Functions

cmd :: LuaError e => DocumentedFunction e Source #

Run a system command

cp :: LuaError e => DocumentedFunction e Source #

Copy a file

cputime :: LuaError e => DocumentedFunction e Source #

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

env :: LuaError e => DocumentedFunction e Source #

Retrieve the entire environment

exists :: LuaError e => DocumentedFunction e Source #

Check the existence of a file path.

getenv :: LuaError e => DocumentedFunction e Source #

Returns the value of an environment variable

getwd :: LuaError e => DocumentedFunction e Source #

Return the current working directory as an absolute path.

ls :: LuaError e => DocumentedFunction e Source #

List the contents of a directory.

mkdir :: LuaError e => DocumentedFunction e Source #

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.

read_file :: LuaError e => DocumentedFunction e Source #

Returns the contents of a file.

rename :: LuaError e => DocumentedFunction e Source #

Rename a file path.

rm :: LuaError e => DocumentedFunction e Source #

Remove a file.

rmdir :: LuaError e => DocumentedFunction e Source #

Remove an existing directory.

setenv :: LuaError e => DocumentedFunction e Source #

Set the specified environment variable to a new value.

setwd :: LuaError e => DocumentedFunction e Source #

Change current working directory.

times :: LuaError e => DocumentedFunction e Source #

Get the modification time and access time of a file.

tmpdirname :: LuaError e => DocumentedFunction e Source #

Get the current directory for temporary files.

with_env :: LuaError e => DocumentedFunction e Source #

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

with_tmpdir :: LuaError e => DocumentedFunction e Source #

Provides a temporary directory for the given action.

with_wd :: LuaError e => DocumentedFunction e Source #

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

write_file :: LuaError e => DocumentedFunction e Source #

Write a string to a file.

xdg :: LuaError e => DocumentedFunction e Source #

Obtain the paths to special directories.