hslua-1.3.0.1: Bindings to Lua, an embeddable scripting language
Copyright© 2020 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilitybeta
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Push

Description

Functions which marshal and push Haskell values onto Lua's stack.

Synopsis

Documentation

type Pusher a = a -> Lua () Source #

Function to push a value to Lua's stack.

Primitives

pushBool :: Pusher Bool Source #

Pushes a Bool as a Lua boolean.

pushIntegral :: (Integral a, Show a) => a -> Lua () Source #

Pushes an Integer to the Lua stack. Values representable as Lua integers are pushed as such; bigger integers are represented using their string representation.

pushRealFloat :: RealFloat a => a -> Lua () Source #

Push a floating point number to the Lua stack. Uses a string representation for all types which do not match the float properties of the Number type.

Strings

pushByteString :: Pusher ByteString Source #

Pushes a ByteString as a raw string.

pushLazyByteString :: Pusher ByteString Source #

Pushes a lazy ByteString as a raw string.

pushString :: String -> Lua () Source #

Pushes a String as an UTF-8 encoded Lua string.

pushText :: Pusher Text Source #

Pushes a Text value as an UTF-8 encoded string.

Collections

pushList :: Pusher a -> [a] -> Lua () Source #

Push list as numerically indexed table.

pushMap :: Pusher a -> Pusher b -> Pusher (Map a b) Source #

Push Map as default key-value Lua table.

pushSet :: Pusher a -> Pusher (Set a) Source #

Push a Set as idiomatic Lua set, i.e., as a table with the set elements as keys and true as values.