lua-2.0.0.1: Lua, an embeddable scripting language
Copyright© 2007–2012 Gracjan Polak;
© 2012–2016 Ömer Sinan Ağacan;
© 2017-2021 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilitybeta
PortabilityForeignFunctionInterface, CPP
Safe HaskellNone
LanguageHaskell2010

Lua.Ersatz.Functions

Description

Ersatz functions for Lua API items which may, directly or indirectly, throw a Lua error.

Synopsis

Documentation

hslua_compare Source #

Arguments

:: State 
-> StackIndex

index 1

-> StackIndex

index 2

-> OPCode

operator

-> Ptr StatusCode

status

-> 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:

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.

Get functions (Lua -> stack)

hslua_gettable :: State -> StackIndex -> Ptr StatusCode -> IO TypeCode Source #

Behaves like lua_gettable, but prevents unrecoverable program crashes by calling that function through lua_pcall. Takes an additional status code pointer that is set to the status returned by lua_pcall.

hslua_getglobal :: State -> CString -> CSize -> Ptr StatusCode -> IO TypeCode Source #

Behaves like lua_getglobal, but prevents unrecoverable program crashes by calling that function through lua_pcall. Takes an additional status code pointer that is set to the status returned by lua_pcall.

Set functions (stack -> Lua)

hslua_settable :: State -> StackIndex -> Ptr StatusCode -> IO () Source #

Behaves like lua_settable, but prevents unrecoverable program crashes by calling that function through lua_pcall. Takes an additional status code pointer that is set to the status returned by lua_pcall.

hslua_setglobal :: State -> CString -> CSize -> Ptr StatusCode -> IO () Source #

Behaves like lua_setglobal, but prevents unrecoverable program crashes by calling that function through lua_pcall. Takes an additional status code pointer that is set to the status returned by lua_pcall.

Misc

hslua_error :: State -> IO NumResults Source #

Replacement for lua_error; it uses the HsLua error signaling convention instead of raw Lua errors.

hslua_next :: State -> StackIndex -> Ptr StatusCode -> IO LuaBool Source #

Wrapper around lua_next which catches any Lua errors.

hslua_concat :: State -> NumArgs -> Ptr StatusCode -> IO () Source #

Wrapper around lua_concat which catches any Lua errors.