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)]
- toList :: FromLuaStack a => StackIndex -> Lua [a]
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
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.
toList :: FromLuaStack a => StackIndex -> Lua [a] Source #
Read a table into a list