hslua-aeson-0.1.0.1: Glue between aeson and hslua

Copyright© 2017 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb@zeitkraut.de>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Scripting.Lua.Aeson

Contents

Description

Glue to hslua for aeson values.

This provides a StackValue instance for aeson's Value type. The following conventions are used:

  • Null values are encoded as the special global _NULL. Using Nil would cause problems with null-containing arrays.
  • Objects are converted to tables in a straight-forward way.
  • Arrays are converted to lua tables. Array-length is included as the value at index 0. This makes it possible to distinguish between empty arrays and empty objects.

Synopsis

Documentation

newstate :: IO LuaState Source #

Create a new lua state suitable for use with aeson values. This behaves like newstate in hslua, but initializes the _NULL global. That variable is used to encode null values.

Orphan instances

StackValue Scientific Source # 
StackValue Text Source # 

Methods

push :: LuaState -> Text -> IO () #

peek :: LuaState -> Int -> IO (Maybe Text) #

valuetype :: Text -> LTYPE #

StackValue Value Source #

Hslua StackValue instance for the Aeson Value data type.

Methods

push :: LuaState -> Value -> IO () #

peek :: LuaState -> Int -> IO (Maybe Value) #

valuetype :: Value -> LTYPE #

StackValue a => StackValue (Vector a) Source # 

Methods

push :: LuaState -> Vector a -> IO () #

peek :: LuaState -> Int -> IO (Maybe (Vector a)) #

valuetype :: Vector a -> LTYPE #

(Eq a, Hashable a, StackValue a, StackValue b) => StackValue (HashMap a b) Source # 

Methods

push :: LuaState -> HashMap a b -> IO () #

peek :: LuaState -> Int -> IO (Maybe (HashMap a b)) #

valuetype :: HashMap a b -> LTYPE #