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

Copyright© 2020 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilityalpha
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Call

Contents

Description

Marshaling and documenting Haskell functions.

Synopsis

Documentation

data HaskellFunction Source #

Haskell equivallent to CFunction, i.e., function callable from Lua.

toHsFnPrecursor :: a -> HsFnPrecursor a Source #

Create a HaskellFunction precursor from a pure function.

applyParameter :: HsFnPrecursor (a -> b) -> Parameter a -> HsFnPrecursor b Source #

Partially apply a parameter.

returnResult :: HsFnPrecursor a -> FunctionResult a -> HaskellFunction Source #

Like returnResult, but returns only a single result.

data Parameter a Source #

Function parameter.

data FunctionResult a Source #

Result of a call to a Haskell function.

type FunctionResults a = [FunctionResult a] Source #

List of function results in the order in which they are returned in Lua.

Operators

(<#>) :: HsFnPrecursor (a -> b) -> Parameter a -> HsFnPrecursor b infixl 8 Source #

Inline version of applyParameter.

(=#>) :: HsFnPrecursor a -> FunctionResults a -> HaskellFunction infixl 8 Source #

Inline version of returnResult.

(#?) :: HaskellFunction -> Text -> HaskellFunction infixl 8 Source #

Inline version of updateFunctionDescription.

Documentation

Pushing to Lua

Convenience functions

parameter Source #

Arguments

:: Peeker a

method to retrieve value from Lua

-> Text

expected Lua type

-> Text

parameter name

-> Text

parameter description

-> Parameter a 

Creates a parameter.

optionalParameter Source #

Arguments

:: Peeker a

method to retrieve the value from Lua

-> Text

expected Lua type

-> Text

parameter name

-> Text

parameter description

-> Parameter (Maybe a) 

Creates an optional parameter.

functionResult Source #

Arguments

:: Pusher a

method to push the Haskell result to Lua

-> Text

Lua type of result

-> Text

result description

-> FunctionResults a 

Creates a function result.