lua-2.1.0: Lua, an embeddable scripting language

Copyright | © 2007–2012 Gracjan Polak; © 2012–2016 Ömer Sinan Ağacan; © 2017-2022 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de>
Stability | beta
Portability | non-portable (depends on GHC)
Safe Haskell | None
Language | Haskell2010

Lua.Ersatz.Auxiliary

Contents

- Auxiliary Library

Description

Raw bindings to ersatz functions of the auxiliary library.

Synopsis

- hsluaL_newstate :: IO State
- hsluaL_requiref :: State -> Ptr CChar -> CFunction -> LuaBool -> Ptr StatusCode -> IO ()
- hsluaL_tolstring :: State -> StackIndex -> Ptr CSize -> IO (Ptr CChar)

# Auxiliary Library

hsluaL_newstate :: IO State #

Creates a new Lua state and set extra registry values for error bookkeeping.

hsluaL_requiref #

Arguments

:: State |
-> Ptr CChar | modname
-> CFunction | openf
-> LuaBool | glb
-> Ptr StatusCode |
-> IO () |

If `modname` is not already present in `package.loaded`. calls function `openf` with string `modname` as an argument and sets the call result in `package.loaded[modname]`, as if that function has been called through require.

If `glb` is true, also stores the module into global `modname`.

Leaves a copy of the module on the stack.

hsluaL_tolstring :: State -> StackIndex -> Ptr CSize -> IO (Ptr CChar) #

Converts object to string, respecting any metamethods; returns `NULL` if an error occurs.