Copyright | © 2020-2022 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de> |
Stability | beta |
Portability | Portable |
Safe Haskell | None |
Language | Haskell2010 |
Functions which marshal and push Haskell values onto Lua's stack.
Synopsis
- type Pusher e a = a -> LuaE e ()
- pushBool :: Pusher e Bool
- pushIntegral :: (Integral a, Show a) => a -> LuaE e ()
- pushRealFloat :: RealFloat a => a -> LuaE e ()
- pushByteString :: Pusher e ByteString
- pushLazyByteString :: Pusher e ByteString
- pushString :: String -> LuaE e ()
- pushText :: Pusher e Text
- pushName :: Name -> LuaE e ()
- pushList :: LuaError e => Pusher e a -> [a] -> LuaE e ()
- pushKeyValuePairs :: LuaError e => Pusher e a -> Pusher e b -> Pusher e [(a, b)]
- pushMap :: LuaError e => Pusher e a -> Pusher e b -> Pusher e (Map a b)
- pushSet :: LuaError e => Pusher e a -> Pusher e (Set a)
- pushPair :: LuaError e => Pusher e a -> Pusher e b -> (a, b) -> LuaE e ()
- pushTriple :: LuaError e => Pusher e a -> Pusher e b -> Pusher e c -> (a, b, c) -> LuaE e ()
- pushAsTable :: LuaError e => [(Name, a -> LuaE e ())] -> a -> LuaE e ()
Documentation
Primitives
pushIntegral :: (Integral a, Show a) => a -> LuaE e () 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 -> LuaE e () 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 e ByteString Source #
Pushes a ByteString
as a raw string.
pushLazyByteString :: Pusher e ByteString Source #
Pushes a lazy ByteString
as a raw string.
Collections
pushList :: LuaError e => Pusher e a -> [a] -> LuaE e () Source #
Push list as numerically indexed table.
pushKeyValuePairs :: LuaError e => Pusher e a -> Pusher e b -> Pusher e [(a, b)] Source #
Push list of pairs as default key-value Lua table.
pushMap :: LuaError e => Pusher e a -> Pusher e b -> Pusher e (Map a b) Source #
Push Map
as default key-value Lua table.
pushSet :: LuaError e => Pusher e a -> Pusher e (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.
Combinators
pushPair :: LuaError e => Pusher e a -> Pusher e b -> (a, b) -> LuaE e () Source #
Pushes a pair of values as a two element list.