hslua-1.3.0: Bindings to Lua, an embeddable scripting language

Copyright© 2019-2020 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <albert+hslua@zeitkraut.de>
Stabilityalpha
PortabilityRequires GHC 8 or later.
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Module

Contents

Description

Utility functions for HsLua modules.

Synopsis

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.

create :: Lua () Source #

Create a new module (i.e., a Lua table).

Module

data Module Source #

Named and documented Lua module.

data Field Source #

Self-documenting module field

Constructors

Field 

registerModule :: Module -> Lua () Source #

Registers a Module; leaves a copy of the module table on the stack.

preloadModule :: Module -> Lua () Source #

Preload self-documenting module.

Documentation

render :: Module -> Text Source #

Renders module documentation as Markdown.