-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | This package provides instances to push and receive any datatype
--   encodable as JSON to and from the Lua stack.
@package hslua-aeson
@version 2.3.1.1


-- | Pushes and retrieves aeson <tt>Value</tt>s to and from the Lua stack.
--   
--   <ul>
--   <li>JSON <tt>null</tt> values are encoded as light userdata containing
--   the <tt>NULL</tt> pointer.</li>
--   <li>Objects are converted to string-indexed tables.</li>
--   <li>Arrays are converted to sequence tables and are given a metatable.
--   This makes it possible to distinguish between empty arrays and empty
--   objects. The metatable is stored in the registry under key <tt>'HsLua
--   JSON array'</tt>' (see also <a>jsonarray</a>).</li>
--   <li>JSON numbers are converted to Lua numbers, i.e., <a>Number</a>;
--   the exact C type may vary, depending on compile-time Lua
--   configuration.</li>
--   </ul>
module HsLua.Aeson

-- | Retrieves an Aeson <a>Value</a> from the Lua stack.
peekValue :: LuaError e => Peeker e Value

-- | Hslua StackValue instance for the Aeson Value data type.
pushValue :: LuaError e => Pusher e Value

-- | Retrieves a value from the Lua stack via JSON.
peekViaJSON :: (FromJSON a, LuaError e) => Peeker e a

-- | Pushes a value to the Lua stack as a JSON-like value.
pushViaJSON :: (ToJSON a, LuaError e) => Pusher e a

-- | Name of the registry slot holding the metatable given to array tables.
--   The registry entry can be replaced with a different table if needed.
jsonarray :: Name

-- | Gets the <a>ToAeson</a> function from a Lua userdata object.
peekToAeson :: Peeker e (ToAeson e)

-- | Pushes a function that converts the object at a given index into a
--   <a>Value</a>.
pushToAeson :: Pusher e (ToAeson e)
