Copyright | Copyright © 2017-2024 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <[email protected]> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
HsLua.CLI
Contents
Description
Embeddable Lua interpreter interface.
Synopsis
- runStandalone :: LuaError e => Settings e -> String -> [String] -> IO ()
- data Settings e = Settings {
- settingsVersionInfo :: Text
- settingsRunner :: EnvBehavior -> LuaE e () -> IO ()
- settingsHistory :: Maybe FilePath
- data EnvBehavior
Run scripts as program
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
.
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.
Constructors
IgnoreEnvVars | |
ConsultEnvVars |
Instances
Show EnvBehavior Source # | |
Defined in HsLua.CLI Methods showsPrec :: Int -> EnvBehavior -> ShowS # show :: EnvBehavior -> String # showList :: [EnvBehavior] -> ShowS # | |
Eq EnvBehavior Source # | |
Defined in HsLua.CLI |