Copyright | © 2007–2012 Gracjan Polak 2012–2016 Ömer Sinan Ağacan 2017 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de> |
Stability | beta |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
HsLua utility functions.
- getglobal' :: String -> Lua ()
- setglobal' :: String -> Lua ()
- runLua :: Lua a -> IO a
- runLuaEither :: Lua a -> IO (Either LuaException a)
- raiseError :: ToLuaStack a => a -> Lua NumResults
- newtype OrNil a = OrNil {}
- newtype Optional a = Optional {
- fromOptional :: Maybe a
Documentation
getglobal' :: String -> Lua () Source #
Like getglobal
, but knows about packages and nested tables. E.g.
getglobal' "math.sin"
will return the function sin
in package math
.
setglobal' :: String -> Lua () Source #
Like setglobal
, but knows about packages and nested tables. E.g.
pushstring "0.9.4" setglobal' "mypackage.version"
All tables and fields, except for the last field, must exist.
runLua :: Lua a -> IO a Source #
Run lua computation using the default HsLua state as starting point. Raised exceptions are passed through; error handling is the responsibility of the caller.
runLuaEither :: Lua a -> IO (Either LuaException a) Source #
Run the given Lua computation; exceptions raised in haskell code are caught, but other exceptions (user exceptions raised in haskell, unchecked type errors, etc.) are passed through.
raiseError :: ToLuaStack a => a -> Lua NumResults Source #
Raise a Lua error, using the given value as the error object. This must be
the return value of a function which has been wrapped with
.wrapHaskellFunction
Like
, but deprecated. Will be removed in the next major
release.Optional
FromLuaStack a => FromLuaStack (OrNil a) Source # | |
ToLuaStack a => ToLuaStack (OrNil a) Source # | |
Newtype wrapper intended to be used for optional Lua values. Nesting this type is strongly discouraged as missing values on inner levels are indistinguishable from missing values on an outer level; wrong values would be the likely result.
Optional | |
|
FromLuaStack a => FromLuaStack (Optional a) Source # | |
ToLuaStack a => ToLuaStack (Optional a) Source # | |