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

Copyright© 2019 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <albert+hslua@zeitkraut.de>
Stabilityalpha
PortabilityRequires GHC 8 or later.
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Module.System

Contents

Description

Provide a Lua module containing a selection of System functions.

Synopsis

Module

pushModule :: Lua NumResults Source #

Pushes the system module to the Lua stack.

preloadModule :: String -> Lua () Source #

Add the system module under the given name to the table of preloaded packages.

Fields

arch :: String Source #

The machine architecture on which the program is running.

compiler_name :: String Source #

The Haskell implementation with which the host program was compiled.

compiler_version :: [Int] Source #

The version of compiler_name with which the host program was compiled.

os :: String Source #

The operating system on which the program is running.

Functions

env :: Lua NumResults Source #

Retrieve the entire environment

getwd :: Lua FilePath Source #

Return the current working directory as an absolute path.

getenv :: String -> Lua (Optional String) Source #

Returns the value of an environment variable

ls :: Optional FilePath -> Lua [FilePath] Source #

List the contents of a directory.

mkdir :: FilePath -> Bool -> Lua () 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.

rmdir :: FilePath -> Bool -> Lua () Source #

Remove an existing directory.

setenv :: String -> String -> Lua () Source #

Set the specified environment variable to a new value.

setwd :: FilePath -> Lua () Source #

Change current working directory.

tmpdirname :: Lua FilePath Source #

Get the current directory for temporary files.

with_env :: Map String String -> Callback -> Lua NumResults Source #

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

with_tmpdir Source #

Arguments

:: String

parent dir or template

-> AnyValue

template or callback

-> Optional Callback

callback or nil

-> Lua NumResults 

with_wd :: FilePath -> Callback -> Lua NumResults Source #

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