Copyright | © 2019 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <albert+hslua@zeitkraut.de> |
Stability | alpha |
Portability | Requires GHC 8 or later. |
Safe Haskell | None |
Language | Haskell2010 |
Utility functions for HsLua modules.
Documentation
requirehs :: String -> Lua () -> Lua () Source #
Load a module, defined by a Haskell action, under the given name.
Similar to luaL_required
: After checking "loaded" table, calls
pushMod
to push a module to the stack, and registers the result in
package.loaded
table.
The pushMod
function must push exactly one element to the top of
the stack. This is not checked, but failure to do so will lead to
problems. Lua's package
module must have been loaded by the time
this function is invoked.
Leaves a copy of the module on the stack.
preloadhs :: String -> Lua NumResults -> Lua () Source #
Registers a preloading function. Takes an module name and the Lua operation which produces the package.
addfield :: Pushable a => String -> a -> Lua () Source #
Add a string-indexed field to the table at the top of the stack.
addfunction :: ToHaskellFunction a => String -> a -> Lua () Source #
Attach a function to the table at the top of the stack, using the given name.