hslua-core-2.0.0: Bindings to Lua, an embeddable scripting language
Copyright© 2019-2021 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <albert+hslua@zeitkraut.de>
Stabilityalpha
PortabilityRequires GHC 8 or later.
Safe HaskellNone
LanguageHaskell2010

HsLua.Core.Package

Description

Utility functions for HsLua modules.

Synopsis

Documentation

requirehs :: LuaError e => Name -> LuaE e () -> LuaE e () 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 :: LuaError e => Name -> LuaE e NumResults -> LuaE e () Source #

Registers a preloading function. Takes an module name and the Lua operation which produces the package.