hslua-module-system alternatives and similar packages
Based on the "hslua" category.
Alternatively, view hslua-module-system alternatives based on common mentions on social networks and blogs.
hslua-module-textLua module providing a selected set of operations on Text. NOTE: moved into the hslua monorepo.
hslua-module-doclayoutLua module wrapping Text.DocLayout.
Do you think we are missing an alternative of hslua-module-system or a related project?
HsLua Module: System
This module provides access to system information and functionality via
Intended usage for this package is to preload it by adding the loader
package.preload. Note that the Lua
package library must
have already been loaded before the loader can be added.
loadProg :: Lua Status loadProg = do openlibs preloadModule "system" -- create a temporary directory, print it's path, then delete it again. dostring $ "system = require 'system'\n" ++ "system.with_tmpdir('.', 'foo', print)"
The machine architecture on which the program is running.
The Haskell implementation with which the host program was compiled.
The version of
compiler_name with which the host program was compiled.
The operating system on which the program is running.
Retrieve the entire environment.
- A table mapping environment variables names to their string value (table).
Return the value of the environment variable
nil if there
is no such value.
: name of the environment variable (string)
- value of the variable, or nil if the variable is not defined (string or nil).
Obtain the current working directory as an absolute path.
- The current working directory (string).
List the contents of a directory.
: Path of the directory whose contents should be listed (string).
- A table of all entries in
directorywithout the special entries (
mkdir (dirname [, create_parent])
Create a new directory which is initially empty, or as near to empty as the operating system allows. The function throws an error if the directory cannot be created, e.g., if the parent directory does not exist or if a directory of the same name is already present.
If the optional second parameter is provided and truthy, then all directories, including parent directories, are created as necessary.
: name of the new directory
: create parent directories if necessary
rmdir (dirname [, recursive])
Remove an existing, empty directory. If
recursive is given,
then delete the directory and its contents recursively.
: name of the directory to delete
: delete content recursively
setenv (var, value)
Set the specified environment variable to a new value.
: name of the environment variable (string).
: new value (string).
Change the working directory to the given path.
: Path of the directory which is to become the new working
Returns the current directory for temporary files.
tmpdirname() returns the value of the
variable or "/tmp" if the variable isn't defined. On Windows, the
function checks for the existence of environment variables in the
following order and uses the first path found:
- TMP environment variable.
- TEMP environment variable.
- USERPROFILE environment variable.
- The Windows directory
The operation may fail if the operating system has no notion of temporary directory.
The function doesn't verify whether the path exists.
- The current directory for temporary files (string).
with_env (environment, callback)
Run an action within a custom environment. Only the environment
variables given by
environment will be set, when
called. The original environment is restored after this function
finishes, even if an error occurs while running the callback
: Environment variables and their values to be set before
callback. (table with string keys and string
: Action to execute in the custom environment (function)
- The result(s) of the call to
with_tmpdir ([parent_dir,] templ, callback)
Create and use a temporary directory inside the given directory. The directory is deleted after use.
: Parent directory to create the directory in (string). If this
parameter is omitted, the system's canonical temporary directory is
: Directory name template (string).
: Function which takes the name of the temporary directory as its
first argument (function).
- The result of the call to
with_wd (directory, callback)
Run an action within a different directory. This function will
change the working directory to
then switch back to the original working directory, even if an
error occurs while running the callback action.
: Directory in which the given
callback should be executed
: Action to execute in the given directory (function)
- The result(s) of the call to
This package is licensed under the MIT license. See [
*Note that all licence references and agreements mentioned in the hslua-module-system README section above are relevant to that project's source code only.