hslua-packaging-2.1.0: Utilities to build Lua modules.

Copyright | © 2020-2022 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de>
Safe Haskell | None
Language | Haskell2010

HsLua.Packaging.Documentation

Description

Provides a function to print documentation if available.

Synopsis

- documentation :: LuaError e => DocumentedFunction e
- getdocumentation :: LuaError e => StackIndex -> LuaE e Type
- registerDocumentation :: LuaError e => StackIndex -> LuaE e ()
- pushModuleDoc :: LuaError e => Pusher e (Module e)
- pushFunctionDoc :: LuaError e => Pusher e (DocumentedFunction e)
- pushFieldDoc :: LuaError e => Pusher e (Field e)
- docsField :: Name

# Documentation

documentation :: LuaError e => DocumentedFunction e #

Function that retrieves documentation.

getdocumentation :: LuaError e => StackIndex -> LuaE e Type #

Pushes the documentation for the element at the given stack index. Returns the type of the documentation object.

registerDocumentation #

Arguments

:: LuaError e |
=> StackIndex |
    idx
-> LuaE e () |

Registers the object at the top of the stack as documentation for the object at index `idx`. Pops the documentation of the stack.

pushModuleDoc :: LuaError e => Pusher e (Module e) #

Pushes the documentation of a module as a table with string fields `name` and `description`.

pushFunctionDoc :: LuaError e => Pusher e (DocumentedFunction e) #

Pushes the documentation of a function as a table with string fields, `name`, `description`, and `since`, sequence field `parameters`, and sequence or string field `results`.

pushFieldDoc :: LuaError e => Pusher e (Field e) #

Pushes the documentation of a field as a table with string fields `name` and `description`.

docsField :: Name #

Name of the registry field holding the documentation table. The documentation table is indexed by the documented objects, like module tables and functions, and contains documentation strings as values.

The table is an ephemeron table, i.e., an entry gets garbage collected if the key is no longer reachable.