Copyright | © 2007–2012 Gracjan Polak; © 2012–2016 Ömer Sinan Ağacan; © 2017-2021 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb+hslua@zeitkraut.de> |
Stability | beta |
Portability | non-portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell2010 |
Sending haskell objects to the lua stack.
Synopsis
- class Peekable a where
- peek :: PeekError e => StackIndex -> LuaE e a
- class LuaError e => PeekError e where
- messageFromException :: e -> String
- peekKeyValuePairs :: (Peekable a, Peekable b, PeekError e) => StackIndex -> LuaE e [(a, b)]
- peekList :: (PeekError e, Peekable a) => StackIndex -> LuaE e [a]
- reportValueOnFailure :: forall e a. PeekError e => ByteString -> (StackIndex -> LuaE e (Maybe a)) -> StackIndex -> LuaE e a
- inContext :: forall e a. PeekError e => String -> LuaE e a -> LuaE e a
Documentation
class Peekable a where Source #
A value that can be read from the Lua stack.
peek :: PeekError e => StackIndex -> LuaE e a Source #
Check if at index n
there is a convertible Lua value and if so return
it. Throws a
otherwise.Exception
Instances
class LuaError e => PeekError e where Source #
Exceptions that are to be used with peek
and similar functions
must be instances of this class. It ensures that error can be amended
with the context in which they happened.
messageFromException :: e -> String Source #
Instances
PeekError Exception Source # | |
Defined in HsLua.Class.Peekable |
peekKeyValuePairs :: (Peekable a, Peekable b, PeekError e) => StackIndex -> LuaE e [(a, b)] Source #
Read a table into a list of pairs.
reportValueOnFailure :: forall e a. PeekError e => ByteString -> (StackIndex -> LuaE e (Maybe a)) -> StackIndex -> LuaE e a Source #
Report the expected and actual type of the value under the given index if conversion failed.