Behaves like lua_gettable, but prevents
unrecoverable program crashes by calling that function through
. Takes an additional status code pointer
that is set to the status returned by Lua.lua_pcalllua_pcall.
Modulelua-2.3.4Haskell2010
Lua.Ersatz
Ersatz functions for Lua API items which may, directly or indirectly, throw a Lua error.
Synopsis
- value hslua_gettable
- value hslua_getglobal
- value hslua_settable
- value hslua_setglobal
- value hslua_error
- value hslua_next
- value hslua_concat
- value hslua_compare
- value hsluaL_newstate
- value hsluaL_tolstring
- Packagelua-2.3.4
- Exports10
- LanguageHaskell2010
- LicenceMIT
- SourceErsatz.hs
Get functions (Lua -> stack)
Behaves like lua_getglobal, but prevents
unrecoverable program crashes by calling that function through
. Takes an additional status code pointer
that is set to the status returned by Lua.lua_pcalllua_pcall.
Set functions (stack -> Lua)
Behaves like lua_settable, but prevents
unrecoverable program crashes by calling that function through
. Takes an additional status code pointer
that is set to the status returned by Lua.lua_pcalllua_pcall.
Behaves like lua_setglobal, but prevents
unrecoverable program crashes by calling that function through
. Takes an additional status code pointer
that is set to the status returned by Lua.lua_pcalllua_pcall.
Misc
Replacement for lua_error; it uses the HsLua error signaling convention instead of raw Lua errors.
Wrapper around lua_next which catches any Lua errors.
Wrapper around lua_concat which catches any Lua errors.
hslua_compare :: State-> StackIndexindex 1
-> StackIndexindex 2
-> OPCodeoperator
-> Ptr StatusCodestatus
-> IO LuaBool
Compares two Lua values. Returns 1 if the value at index index1
satisfies op when compared with the value at index index2,
following the semantics of the corresponding Lua operator (that is,
it may call metamethods). Otherwise returns 0. Also returns 0 if
any of the indices is not valid.
The value of op must be one of the following constants:
LUA_OPEQ: compares for equality (==)
LUA_OPLT: compares for less than (<)
LUA_OPLE: compares for less or equal (<=)
This function wraps lua_compare and takes an additional parameter
status; if it is not NULL, then the return value is set to the
status after calling lua_compare.
Auxiliary Library
Creates a new Lua state and set extra registry values for error bookkeeping.
Converts object to string, respecting any metamethods; returns
NULL if an error occurs.