hslua-core-2.2.1: Bindings to Lua, an embeddable scripting language
Copyright© 2019-2022 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 Source #

Arguments

:: LuaError e 
=> Name

modname

-> (Name -> LuaE e ())

openf

-> LuaE e () 

Load a module, defined by a Haskell action, under the given name.

Similar to luaL_requiref: 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.

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.