hslua-cli-1.4.2: Command-line interface for Lua
CopyrightCopyright © 2017-2024 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb@hslua.org>
Safe HaskellSafe-Inferred
LanguageHaskell2010

HsLua.CLI

Description

Embeddable Lua interpreter interface.

Synopsis

Run scripts as program

runStandalone Source #

Arguments

:: LuaError e 
=> Settings e

interpreter configuration

-> String

program name (for error messages)

-> [String]

command line arguments

-> IO () 

Uses the first command line argument as the name of a script file and tries to run that script in Lua. Falls back to stdin if no file is given. Any remaining args are passed to Lua via the global table arg.

data Settings e Source #

Settings for the Lua command line interface.

If env vars should be ignored, and the interpreter invokes openlibs, then the registry key LUA_NOENV should be set to true before that function is invoked. E.g.:

runner envBehavior action = run $ do
  when (envBehavior == IgnoreEnvVars) $ do
    pushboolean True
    setfield registryindex "LUA_NOENV"
  openlibs
  action

Constructors

Settings 

Fields

data EnvBehavior Source #

Whether environment variables should be consulted or ignored.

Instances

Instances details
Show EnvBehavior Source # 
Instance details

Defined in HsLua.CLI

Eq EnvBehavior Source # 
Instance details

Defined in HsLua.CLI