hslua-aeson-2.0.0: Allow aeson data types to be used with lua.
Copyright© 2017–2021 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb@zeitkraut.de>
Safe HaskellNone
LanguageHaskell2010

HsLua.Aeson

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 a special value (stored in the registry field HSLUA_AESON_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.
  • JSON numbers are converted to Lua numbers (usually doubles), which can cause a loss of precision.
Synopsis

Documentation

pushValue :: LuaError e => Pusher e Value Source #

Hslua StackValue instance for the Aeson Value data type.

peekVector :: LuaError e => Peeker e a -> Peeker e (Vector a) Source #

Try reading the value under the given index as a vector.

pushVector :: LuaError e => Pusher e a -> Pusher e (Vector a) Source #

Push a vector onto the stack.

pushNull :: LuaError e => LuaE e () Source #

Push the value which represents JSON null values to the stack (a specific empty table by default). Internally, this uses the contents of the HSLUA_AESON_NULL registry field; modifying this field is possible, but it must always be non-nil.

peekKeyMap :: Peeker e a -> Peeker e (KeyMap a) Source #

Retrieves a KeyMap from a Lua table.

pushKeyMap :: LuaError e => Pusher e a -> Pusher e (KeyMap a) Source #

Pushes a KeyMap onto the stack.