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


-- | Bindings to Lua, an embeddable scripting language
--   
--   HsLua provides wrappers and helpers to bridge Haskell and <a>Lua</a>.
--   
--   It builds upon the <i>lua</i> package, which allows to bundle a Lua
--   interpreter with a Haskell program.
--   
--   <a>Example programs</a> are available in a separate repository.
@package hslua
@version 2.0.1


-- | HsLua utility functions.
module HsLua.Util

-- | Like <tt>getglobal</tt>, but knows about packages and nested tables.
--   E.g.
--   
--   <pre>
--   getglobal' "math.sin"
--   </pre>
--   
--   will return the function <tt>sin</tt> in package <tt>math</tt>.
getglobal' :: LuaError e => Name -> LuaE e ()

-- | Like <tt>setglobal</tt>, but knows about packages and nested tables.
--   E.g.
--   
--   <pre>
--   pushstring "0.9.4"
--   setglobal' "mypackage.version"
--   </pre>
--   
--   All tables and fields, except for the last field, must exist.
setglobal' :: LuaError e => Name -> LuaE e ()


-- | Functions and utilities enabling the seamless integration of a Lua
--   interpreter into a Haskell project.
--   
--   This module combines and re-exports the functionality of the HsLua
--   framework. Basic access to the Lua API is provided by
--   <tt><a>Core</a></tt> from Hackage package <i>lua</i>.
module HsLua

-- | Specify a name for the context in which a computation is run. The name
--   is added to the error message in case of an exception.
inContext :: PeekError e => String -> LuaE e a -> LuaE e a

-- | A value that can be read from the Lua stack.
class Peekable a

-- | Check if at index <tt>n</tt> there is a convertible Lua value and if
--   so return it. Throws a <tt><a>Exception</a></tt> otherwise.
peek :: (Peekable a, PeekError e) => StackIndex -> LuaE e a
messageFromException :: PeekError e => e -> String

-- | A value that can be pushed to the Lua stack.
class Pushable a

-- | Pushes a value onto Lua stack, casting it into meaningfully nearest
--   Lua type.
push :: (Pushable a, LuaError e) => a -> LuaE e ()

-- | Like <tt>getglobal</tt>, but knows about packages and nested tables.
--   E.g.
--   
--   <pre>
--   getglobal' "math.sin"
--   </pre>
--   
--   will return the function <tt>sin</tt> in package <tt>math</tt>.
getglobal' :: LuaError e => Name -> LuaE e ()

-- | Like <tt>setglobal</tt>, but knows about packages and nested tables.
--   E.g.
--   
--   <pre>
--   pushstring "0.9.4"
--   setglobal' "mypackage.version"
--   </pre>
--   
--   All tables and fields, except for the last field, must exist.
setglobal' :: LuaError e => Name -> LuaE e ()
