hslua-classes-2.1.0: Type classes for HsLua
Copyright© 2007–2012 Gracjan Polak;
© 2012–2016 Ömer Sinan Ağacan;
© 2017-2022 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilitybeta
Portabilitynon-portable (depends on GHC)
Safe HaskellNone
LanguageHaskell2010

HsLua.Class.Util

Description

HsLua utility functions.

Synopsis

Documentation

raiseError :: (LuaError e, Pushable a) => a -> LuaE e NumResults Source #

Raise a Lua error, using the given value as the error object.

newtype Optional a Source #

Newtype wrapper intended to be used for optional Lua values. Nesting this type is strongly discouraged as missing values on inner levels are indistinguishable from missing values on an outer level; wrong values would be the likely result.

Constructors

Optional 

Fields

Instances

Instances details
Peekable a => Peekable (Optional a) Source # 
Instance details

Defined in HsLua.Class.Util

Methods

safepeek :: LuaError e => Peeker e (Optional a) Source #

Pushable a => Pushable (Optional a) Source # 
Instance details

Defined in HsLua.Class.Util

Methods

push :: LuaError e => Optional a -> LuaE e () Source #

getting values

peekEither :: (LuaError e, Peekable a) => StackIndex -> LuaE e (Either e a) Source #

Try to convert the value at the given stack index to a Haskell value. Returns Left with the error on failure.

popValue :: (LuaError e, Peekable a) => LuaE e a Source #

Get, then pop the value at the top of the stack. The pop operation is executed even if the retrieval operation failed.