| Copyright | © 2019-2026 Albert Krewinkel |
|---|---|
| License | MIT |
| Maintainer | Albert Krewinkel <tarleb@hslua.org> |
| Stability | alpha |
| Portability | Requires GHC 8 or later. |
| Safe Haskell | None |
| Language | Haskell2010 |
HsLua.Packaging.Module
Description
Utility functions for HsLua modules.
Synopsis
- data Module e = Module {
- moduleName :: Name
- moduleDescription :: Text
- moduleFields :: [Field e]
- moduleFunctions :: [DocumentedFunction e]
- moduleOperations :: [(Operation, DocumentedFunction e)]
- moduleTypeInitializers :: [LuaE e Name]
- moduleTypeDocs :: [TypeDoc]
- data ModuleDoc = ModuleDoc {}
- data Field e = Field {
- fieldName :: Name
- fieldDoc :: FieldDoc
- fieldPushValue :: LuaE e ()
- defmodule :: Name -> Module e
- withFields :: Module e -> [Field e] -> Module e
- withFunctions :: Module e -> [DocumentedFunction e] -> Module e
- withOperations :: Module e -> [(Operation, DocumentedFunction e)] -> Module e
- associateType :: LuaError e => Module e -> DocumentedType e a -> Module e
- renameTo :: HasName a => a -> Name -> a
- deffield :: Name -> Field e
- withType :: Field e -> TypeSpec -> Field e
- withDescription :: HasDescription a => a -> Text -> a
- withValue :: Field e -> LuaE e () -> Field e
- class HasName a where
- class HasDescription a where
- getDescription :: a -> Text
- setDescription :: a -> Text -> a
- registerModule :: LuaError e => Module e -> LuaE e ()
- preloadModule :: LuaError e => Module e -> LuaE e ()
- preloadModuleWithName :: LuaError e => Module e -> Name -> LuaE e ()
- pushModule :: LuaError e => Module e -> LuaE e ()
- data Operation
Documented module
Named and documented Lua module.
Constructors
| Module | |
Fields
| |
Instances
| HasDescription (Module e) Source # | |
Defined in HsLua.Packaging.Types | |
| HasName (Module e) Source # | |
Module documentation
Constructors
| ModuleDoc | |
Fields
| |
Instances
| Show ModuleDoc Source # | |
| Eq ModuleDoc Source # | |
| Ord ModuleDoc Source # | |
Defined in HsLua.Packaging.Types | |
| HasDescription ModuleDoc Source # | |
Defined in HsLua.Packaging.Types | |
Self-documenting module field
Constructors
| Field | |
Fields
| |
Instances
| HasDescription (Field e) Source # | |
Defined in HsLua.Packaging.Types | |
| HasName (Field e) Source # | |
Constructors
Module
withFunctions :: Module e -> [DocumentedFunction e] -> Module e infixl 0 Source #
Set the list of functions in the module.
withOperations :: Module e -> [(Operation, DocumentedFunction e)] -> Module e infixl 0 Source #
Set operations that can be performed on the module object.
associateType :: LuaError e => Module e -> DocumentedType e a -> Module e infixl 0 Source #
Associate a type with this module. An associated type is listed in the module documentation.
Field
withDescription :: HasDescription a => a -> Text -> a infixl 0 Source #
Sets a textual description
Type Classes
class HasName a where Source #
Named objects
Instances
| HasName (DocumentedFunction e) Source # | |
Defined in HsLua.Packaging.Types Methods getName :: DocumentedFunction e -> Name Source # setName :: DocumentedFunction e -> Name -> DocumentedFunction e Source # | |
| HasName (Field e) Source # | |
| HasName (Module e) Source # | |
class HasDescription a where Source #
Objects that have descriptions.
Instances
| HasDescription FieldDoc Source # | |
Defined in HsLua.Packaging.Types | |
| HasDescription ModuleDoc Source # | |
Defined in HsLua.Packaging.Types | |
| HasDescription (Field e) Source # | |
Defined in HsLua.Packaging.Types | |
| HasDescription (Module e) Source # | |
Defined in HsLua.Packaging.Types | |
Module Loading
registerModule :: LuaError e => Module e -> LuaE e () Source #
Registers a Module; leaves a copy of the module table on
the stack.
preloadModule :: LuaError e => Module e -> LuaE e () Source #
Preload self-documenting module using the module's default name.
preloadModuleWithName :: LuaError e => Module e -> Name -> LuaE e () Source #
Add the module under a different name to the table of preloaded packages.
pushModule :: LuaError e => Module e -> LuaE e () Source #
Pushes a documented module to the Lua stack.
Lua metadata operation types.
Constructors
| Add | the addition ( |
| Sub | the subtraction ( |
| Mul | the multiplication ( |
| Div | the division ( |
| Mod | the modulo ( |
| Pow | the exponentiation ( |
| Unm | the negation (unary |
| Idiv | the floor division ( |
| Band | the bitwise AND ( |
| Bor | the bitwise OR ( |
| Bxor | the bitwise exclusive OR (binary |
| Bnot | the bitwise NOT (unary |
| Shl | the bitwise left shift ( |
| Shr | the bitwise right shift ( |
| Concat | the concatenation ( |
| Len | the length ( |
| Eq | the equal ( |
| Lt | the less than ( |
| Le | the less equal ( |
| Index | The indexing access operation |
| Newindex | The indexing assignment |
| Call | The call operation |
| Tostring | The operation used to create a string representation of the object. |
| Pairs | the operation of iterating over the object's key-value pairs. |
| CustomOperation Name | a custom operation, with the metamethod name as parameter. |
Instances
| Show Operation | |
| Eq Operation | |
| Ord Operation | |
Defined in HsLua.ObjectOrientation.Operation | |