Copyright | © 2007–2012 Gracjan Polak 2012–2016 Ömer Sinan Ağacan 2017 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de> |
Stability | beta |
Portability | FlexibleInstances, ScopedTypeVariables |
Safe Haskell | None |
Language | Haskell98 |
Sending haskell objects to the lua stack.
- class FromLuaStack a where
- type Result a = Either String a
- peekEither :: FromLuaStack a => StackIndex -> Lua (Either String a)
- pairsFromTable :: (FromLuaStack a, FromLuaStack b) => StackIndex -> Lua [(a, b)]
Documentation
class FromLuaStack a where Source #
A value that can be read from the Lua stack.
peek :: StackIndex -> Lua a Source #
Check if at index n
there is a convertible Lua value and if so return
it. Throws a
otherwise.LuaException
FromLuaStack Bool Source # | |
FromLuaStack Int Source # | |
FromLuaStack () Source # | |
FromLuaStack ByteString Source # | |
FromLuaStack Text Source # | |
FromLuaStack LuaNumber Source # | |
FromLuaStack LuaInteger Source # | |
FromLuaStack CFunction Source # | |
FromLuaStack LuaState Source # | |
FromLuaStack [Char] Source # | |
FromLuaStack a => FromLuaStack [a] Source # | |
FromLuaStack (Ptr a) Source # | |
(Ord a, FromLuaStack a, FromLuaStack b) => FromLuaStack (Map a b) Source # | |
type Result a = Either String a Source #
Result returned when trying to get a value from the lua stack.
peekEither :: FromLuaStack a => StackIndex -> Lua (Either String a) Source #
Try to convert the value at the given stack index to a haskell value.
Returns Left
with an error message on failure.
pairsFromTable :: (FromLuaStack a, FromLuaStack b) => StackIndex -> Lua [(a, b)] Source #
Read a table into a list of pairs.