hslua-1.0.3.2: Bindings to Lua, an embeddable scripting language

Copyright© 2017-2019 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+hslua@zeitkraut.de>
Stabilitybeta
PortabilityDeriveDataTypeable
Safe HaskellNone
LanguageHaskell2010

Foreign.Lua.Core.Error

Contents

Description

Lua exceptions and exception handling.

Synopsis

Documentation

newtype Exception Source #

Exceptions raised by Lua-related operations.

Constructors

Exception 

catchException :: Lua a -> (Exception -> Lua a) -> Lua a Source #

Catch a Lua Exception.

throwException :: String -> Lua a Source #

Raise a Lua Exception containing the given error message.

withExceptionMessage :: (String -> String) -> Lua a -> Lua a Source #

Catch Lua Exception, alter the message and rethrow.

throwTopMessage :: Lua a Source #

Convert the object at the top of the stack into a string and throw it as an Exception.

try :: Lua a -> Lua (Either Exception a) Source #

Return either the result of a Lua computation or, if an exception was thrown, the error.

Helpers for hslua C wrapper functions.

newtype Failable a Source #

CInt value or an error, using the convention that value below zero indicate an error. Values greater than zero are used verbatim. The phantom type is used for additional type safety and gives the type into which the wrapped CInt should be converted.

Constructors

Failable CInt 

fromFailable :: (CInt -> a) -> Failable a -> Lua a Source #

Convert from Failable to target type, throwing an error if the value indicates a failure.

throwOnError :: Failable () -> Lua () Source #

Throw a Haskell exception if the computation signaled a failure.

boolFromFailable :: Failable LuaBool -> Lua Bool Source #

Convert lua boolean to Haskell Bool, throwing an exception if the return value indicates that an error had happened.

Signaling errors to Lua

hsluaErrorRegistryField :: String Source #

Registry field under which the special HsLua error indicator is stored.

Orphan instances

Alternative Lua Source # 
Instance details

Methods

empty :: Lua a #

(<|>) :: Lua a -> Lua a -> Lua a #

some :: Lua a -> Lua [a] #

many :: Lua a -> Lua [a] #