Haskell equivallent to CFunction, i.e., function callable from Lua.
Modulehslua-packaging-2.3.1Haskell2010
HsLua.Packaging.Function
Marshaling and documenting Haskell functions.
- 5 types
- 25 values
- Packagehslua-packaging-2.3.1
- Exports30
- LanguageHaskell2010
- LicenceMIT
- SourceFunction.hs
Creating documented functions
12 declarationsBegin wrapping a monadic Lua function such that it can be turned into a documented function exposable to Lua.
Just like defun, but uses an empty name for the documented
function. Should be used when defining methods or operators.
Partially apply a parameter.
Like returnResult, but returns only a single result.
Take a HaskellFunction precursor and convert it into a full HaskellFunction, using the given FunctionResults to return the result to Lua.
Take a HaskellFunction precursor and convert it into a full HaskellFunction, using the given FunctionResults to return the result to Lua.
Updates the description of a Haskell function. Leaves the function unchanged if it has no documentation.
Turns a pure function into a monadic Lua function.
The resulting function is strict.
Turns a binary function into a Lua function.
The resulting function is strict in both its arguments.
Turns a ternary function into a Lua function.
The resulting function is strict in all of its arguments.
Turns a quarternary function into a Lua function.
The resulting function is strict in all of its arguments.
Turns a quinary function into a Lua function.
The resulting function is strict in all of its arguments.
Types
Function parameter.
Constructors
Result of a call to a Haskell function.
Constructors
List of function results in the order in which they are returned in Lua.
Operators
Like ($), but left associative.
Inline version of applyParameter.
Inline version of returnResults.
Return a flexible number of results that have been pushed by the function action.
Inline version of updateFunctionDescription.
Modifying functions
2 declarationsRenames a documented function.
Sets the library version at which the function was introduced in its current form.
Pushing to Lua
1 declarationPushes a documented Haskell function to the Lua stack, making it usable as a normal function in Lua. At the same time, the function docs are registered in the documentation table.
Convenience functions
4 declarationsparameter Creates a parameter.
Makes a parameter optional.
optionalParameter Deprecated. Use `opt (parameter ...)` instead.
Creates an optional parameter.
DEPRECATED: Use opt (parameter ...) instead.
functionResult :: Pusher e amethod to push the Haskell result to Lua
-> TypeSpecLua type of result
-> Textresult description
-> FunctionResults e a
Creates a function result.
Internal
2 declarationsHelper type used to create HaskellFunctions.
Instances1Functor
Functor (HsFnPrecursor e)Defined in hslua-packaging-2.3.1 · HsLua.Packaging.Function
Create a HaskellFunction precursor from a monadic function, selecting the stack index after which the first function parameter will be placed.