-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Lua language interpreter embedding in Haskell -- -- The Scripting.Lua module is a wrapper of Lua language interpreter as -- described in lua.org. -- -- This package contains full Lua interpreter version 5.1.5. If you want -- to link it with system-wide Lua installation, use system-lua -- flag. -- -- Example programs @package hslua @version 0.5.0 module Scripting.Lua.Raw -- | Synonym for lua_State *. See lua_State in Lua -- Reference Manual. newtype LuaState LuaState :: (Ptr ()) -> LuaState -- | Synonym for lua_Alloc. See lua_Alloc in Lua -- Reference Manual. type LuaAlloc = Ptr () -> Ptr () -> CSize -> CSize -> IO (Ptr ()) -- | Synonym for lua_Reader. See lua_Reader in Lua -- Reference Manual. type LuaReader = Ptr () -> Ptr () -> Ptr CSize -> IO (Ptr CChar) -- | Synonym for lua_Writer. See lua_Writer in Lua -- Reference Manual. type LuaWriter = LuaState -> Ptr CChar -> CSize -> Ptr () -> IO CInt -- | Synonym for lua_CFunction. See lua_CFunction in Lua -- Reference Manual. type LuaCFunction = LuaState -> IO CInt -- | Synonym for lua_Integer. See lua_Integer in Lua -- Reference Manual. type LuaInteger = Int64 -- | Synonym for lua_Number. See lua_Number in Lua -- Reference Manual. type LuaNumber = Double c_lua_newstate :: FunPtr LuaAlloc -> Ptr () -> IO LuaState c_lua_close :: LuaState -> IO () c_lua_newthread :: LuaState -> IO LuaState c_lua_atpanic :: LuaState -> FunPtr LuaCFunction -> IO (FunPtr LuaCFunction) c_lua_gettop :: LuaState -> IO CInt c_lua_settop :: LuaState -> CInt -> IO () c_lua_pushvalue :: LuaState -> CInt -> IO () c_lua_remove :: LuaState -> CInt -> IO () c_lua_insert :: LuaState -> CInt -> IO () c_lua_replace :: LuaState -> CInt -> IO () c_lua_checkstack :: LuaState -> CInt -> IO CInt c_lua_xmove :: LuaState -> LuaState -> CInt -> IO () c_lua_isnumber :: LuaState -> CInt -> IO CInt c_lua_isstring :: LuaState -> CInt -> IO CInt c_lua_iscfunction :: LuaState -> CInt -> IO CInt c_lua_isuserdata :: LuaState -> CInt -> IO CInt c_lua_type :: LuaState -> CInt -> IO CInt c_lua_typename :: LuaState -> CInt -> IO (Ptr CChar) c_lua_equal :: LuaState -> CInt -> CInt -> IO CInt c_lua_rawequal :: LuaState -> CInt -> CInt -> IO CInt c_lua_lessthan :: LuaState -> CInt -> CInt -> IO CInt c_lua_tonumber :: LuaState -> CInt -> IO LuaNumber c_lua_tointeger :: LuaState -> CInt -> IO LuaInteger c_lua_toboolean :: LuaState -> CInt -> IO CInt c_lua_tolstring :: LuaState -> CInt -> Ptr CSize -> IO (Ptr CChar) c_lua_objlen :: LuaState -> CInt -> IO CSize c_lua_tocfunction :: LuaState -> CInt -> IO (FunPtr LuaCFunction) c_lua_touserdata :: LuaState -> CInt -> IO (Ptr a) c_lua_tothread :: LuaState -> CInt -> IO LuaState c_lua_topointer :: LuaState -> CInt -> IO (Ptr ()) c_lua_pushnil :: LuaState -> IO () c_lua_pushnumber :: LuaState -> LuaNumber -> IO () c_lua_pushinteger :: LuaState -> LuaInteger -> IO () c_lua_pushlstring :: LuaState -> Ptr CChar -> CSize -> IO () c_lua_pushstring :: LuaState -> Ptr CChar -> IO () c_lua_pushcclosure :: LuaState -> FunPtr LuaCFunction -> CInt -> IO () c_lua_pushboolean :: LuaState -> CInt -> IO () c_lua_pushlightuserdata :: LuaState -> Ptr a -> IO () c_lua_pushthread :: LuaState -> IO CInt c_lua_gettable :: LuaState -> CInt -> IO () c_lua_getfield :: LuaState -> CInt -> Ptr CChar -> IO () c_lua_rawget :: LuaState -> CInt -> IO () c_lua_rawgeti :: LuaState -> CInt -> CInt -> IO () c_lua_createtable :: LuaState -> CInt -> CInt -> IO () c_lua_newuserdata :: LuaState -> CInt -> IO (Ptr ()) c_lua_getmetatable :: LuaState -> CInt -> IO CInt c_lua_getfenv :: LuaState -> CInt -> IO () c_lua_settable :: LuaState -> CInt -> IO () c_lua_setfield :: LuaState -> CInt -> Ptr CChar -> IO () c_lua_rawset :: LuaState -> CInt -> IO () c_lua_rawseti :: LuaState -> CInt -> CInt -> IO () c_lua_setmetatable :: LuaState -> CInt -> IO () c_lua_setfenv :: LuaState -> CInt -> IO CInt c_lua_call :: LuaState -> CInt -> CInt -> IO () c_lua_pcall :: LuaState -> CInt -> CInt -> CInt -> IO CInt c_lua_cpcall :: LuaState -> FunPtr LuaCFunction -> Ptr a -> IO CInt c_lua_load :: LuaState -> FunPtr LuaReader -> Ptr () -> Ptr CChar -> IO CInt c_lua_dump :: LuaState -> FunPtr LuaWriter -> Ptr () -> IO () c_lua_yield :: LuaState -> CInt -> IO CInt c_lua_resume :: LuaState -> CInt -> IO CInt c_lua_status :: LuaState -> IO CInt c_lua_gc :: LuaState -> CInt -> CInt -> IO CInt c_lua_error :: LuaState -> IO CInt c_lua_next :: LuaState -> CInt -> IO CInt c_lua_concat :: LuaState -> CInt -> IO () c_luaL_openlibs :: LuaState -> IO () c_lua_open_base :: LuaState -> IO CInt c_lua_open_base_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_table :: LuaState -> IO CInt c_lua_open_table_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_io :: LuaState -> IO CInt c_lua_open_io_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_os :: LuaState -> IO CInt c_lua_open_os_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_string :: LuaState -> IO CInt c_lua_open_string_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_math :: LuaState -> IO CInt c_lua_open_math_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_debug :: LuaState -> IO CInt c_lua_open_debug_ptr :: FunPtr (LuaState -> IO CInt) c_lua_open_package :: LuaState -> IO CInt c_lua_open_package_ptr :: FunPtr (LuaState -> IO CInt) c_luaL_newstate :: IO LuaState c_luaL_newmetatable :: LuaState -> Ptr CChar -> IO CInt c_luaL_argerror :: LuaState -> CInt -> Ptr CChar -> IO CInt c_luaL_ref :: LuaState -> CInt -> IO CInt c_luaL_unref :: LuaState -> CInt -> CInt -> IO () c_luaL_loadfile :: LuaState -> Ptr CChar -> IO CInt c_luaL_loadstring :: LuaState -> Ptr CChar -> IO CInt module Scripting.Lua -- | Synonym for lua_State *. See lua_State in Lua -- Reference Manual. data LuaState -- | Synonym for lua_CFunction. See lua_CFunction in Lua -- Reference Manual. type LuaCFunction = LuaState -> IO CInt -- | Synonym for lua_Integer. See lua_Integer in Lua -- Reference Manual. type LuaInteger = Int64 -- | Synonym for lua_Number. See lua_Number in Lua -- Reference Manual. type LuaNumber = Double -- | Enumeration used as type tag. See lua_type. data LTYPE TNONE :: LTYPE TNIL :: LTYPE TBOOLEAN :: LTYPE TLIGHTUSERDATA :: LTYPE TNUMBER :: LTYPE TSTRING :: LTYPE TTABLE :: LTYPE TFUNCTION :: LTYPE TUSERDATA :: LTYPE TTHREAD :: LTYPE -- | Enumeration used by gc function. data GCCONTROL GCSTOP :: GCCONTROL GCRESTART :: GCCONTROL GCCOLLECT :: GCCONTROL GCCOUNT :: GCCONTROL GCCOUNTB :: GCCONTROL GCSTEP :: GCCONTROL GCSETPAUSE :: GCCONTROL GCSETSTEPMUL :: GCCONTROL -- | Alias for C constant LUA_MULTRET. See lua_call. multret :: Int -- | See lua_settop. settop :: LuaState -> Int -> IO () -- | See lua_createtable. createtable :: LuaState -> Int -> Int -> IO () -- | See lua_objlen. objlen :: LuaState -> Int -> IO Int -- | See lua_pop. pop :: LuaState -> Int -> IO () -- | See lua_newtable. newtable :: LuaState -> IO () -- | See lua_pushcclosure. pushcclosure :: LuaState -> FunPtr LuaCFunction -> Int -> IO () -- | See lua_pushcfunction. pushcfunction :: LuaState -> FunPtr LuaCFunction -> IO () -- | Compatibility alias for objlen -- | Deprecated: Use objlen instead. strlen :: LuaState -> Int -> IO Int -- | See lua_type. ltype :: LuaState -> Int -> IO LTYPE -- | See lua_isfunction. isfunction :: LuaState -> Int -> IO Bool -- | See lua_istable. istable :: LuaState -> Int -> IO Bool -- | Try to convert Lua array at given index to Haskell list. tolist :: StackValue a => LuaState -> Int -> IO (Maybe [a]) -- | See lua_islightuserdata. islightuserdata :: LuaState -> Int -> IO Bool -- | See lua_isnil. isnil :: LuaState -> Int -> IO Bool -- | See lua_isboolean. isboolean :: LuaState -> Int -> IO Bool -- | See lua_isthread. isthread :: LuaState -> Int -> IO Bool -- | See lua_isnone. isnone :: LuaState -> Int -> IO Bool -- | See lua_isnoneornil. isnoneornil :: LuaState -> Int -> IO Bool -- | Alias for C constant LUA_REGISTRYINDEX. See Lua -- registry. registryindex :: Int -- | Alias for C constant LUA_ENVIRONINDEX. See -- pseudo-indices. environindex :: Int -- | Alias for C constant LUA_GLOBALSINDEX. See -- pseudo-indices. globalsindex :: Int -- | See lua_upvalueindex. upvalueindex :: Int -> Int -- | See lua_atpanic. atpanic :: LuaState -> FunPtr LuaCFunction -> IO (FunPtr LuaCFunction) -- | See lua_tostring. tostring :: LuaState -> Int -> IO ByteString -- | See lua_tothread. tothread :: LuaState -> Int -> IO LuaState -- | See lua_touserdata. touserdata :: LuaState -> Int -> IO (Ptr a) -- | See lua_typename. typename :: LuaState -> LTYPE -> IO String -- | See lua_xmove. xmove :: LuaState -> LuaState -> Int -> IO () -- | See lua_yield. yield :: LuaState -> Int -> IO Int -- | See lua_checkstack. checkstack :: LuaState -> Int -> IO Bool -- | See lua_newstate and luaL_newstate. newstate :: IO LuaState -- | See lua_close. close :: LuaState -> IO () -- | See lua_concat. concat :: LuaState -> Int -> IO () -- | See lua_call and lua_call. call :: LuaState -> Int -> Int -> IO () -- | See lua_pcall. pcall :: LuaState -> Int -> Int -> Int -> IO Int -- | See lua_cpcall. cpcall :: LuaState -> FunPtr LuaCFunction -> Ptr a -> IO Int -- | See lua_getfield. getfield :: LuaState -> Int -> String -> IO () -- | See lua_setfield. setfield :: LuaState -> Int -> String -> IO () -- | See lua_getglobal. getglobal :: LuaState -> String -> IO () -- | See lua_setglobal. setglobal :: LuaState -> String -> IO () -- | See luaL_openlibs. openlibs :: LuaState -> IO () -- | See luaopen_base. openbase :: LuaState -> IO () -- | See luaopen_table. opentable :: LuaState -> IO () -- | See luaopen_io. openio :: LuaState -> IO () -- | See luaopen_os. openos :: LuaState -> IO () -- | See luaopen_string. openstring :: LuaState -> IO () -- | See luaopen_math. openmath :: LuaState -> IO () -- | See luaopen_debug. opendebug :: LuaState -> IO () -- | See luaopen_package. openpackage :: LuaState -> IO () mkStringWriter :: LuaWriter -> IO (FunPtr LuaWriter) -- | See lua_dump. dump :: LuaState -> IO String -- | See lua_equal. equal :: LuaState -> Int -> Int -> IO Bool -- | This is a convenience function to implement error propagation -- convention described in Error handling in hslua. hslua doesn't -- implement lua_error function from Lua C API because it's -- never safe to use. (see Error handling in hslua for details) lerror :: LuaState -> IO Int -- | See lua_gc. gc :: LuaState -> GCCONTROL -> Int -> IO Int -- | See lua_getfenv. getfenv :: LuaState -> Int -> IO () -- | See lua_getmetatable. getmetatable :: LuaState -> Int -> IO Bool -- | See lua_gettable. gettable :: LuaState -> Int -> IO () -- | See lua_gettop. gettop :: LuaState -> IO Int -- | See lua_insert. insert :: LuaState -> Int -> IO () -- | See lua_iscfunction. iscfunction :: LuaState -> Int -> IO Bool -- | See lua_isnumber. isnumber :: LuaState -> Int -> IO Bool -- | See lua_isstring. isstring :: LuaState -> Int -> IO Bool -- | See lua_isuserdata. isuserdata :: LuaState -> Int -> IO Bool -- | See lua_lessthan. lessthan :: LuaState -> Int -> Int -> IO Bool -- | See luaL_loadfile. loadfile :: LuaState -> String -> IO Int -- | See luaL_loadstring. loadstring :: LuaState -> String -> IO Int -- | See lua_newthread. newthread :: LuaState -> IO LuaState -- | See lua_newuserdata. newuserdata :: LuaState -> Int -> IO (Ptr ()) -- | See lua_next. next :: LuaState -> Int -> IO Bool -- | See lua_pushboolean. pushboolean :: LuaState -> Bool -> IO () -- | See lua_pushinteger. pushinteger :: LuaState -> LuaInteger -> IO () -- | See lua_pushlightuserdata. pushlightuserdata :: LuaState -> Ptr a -> IO () -- | See lua_pushnil. pushnil :: LuaState -> IO () -- | See lua_pushnumber. pushnumber :: LuaState -> LuaNumber -> IO () -- | See lua_pushstring. pushstring :: LuaState -> ByteString -> IO () -- | Push a list to Lua stack as a Lua array. pushlist :: StackValue a => LuaState -> [a] -> IO () -- | See lua_pushthread. pushthread :: LuaState -> IO Bool -- | See lua_pushvalue. pushvalue :: LuaState -> Int -> IO () -- | See lua_rawequal. rawequal :: LuaState -> Int -> Int -> IO Bool -- | See lua_rawget. rawget :: LuaState -> Int -> IO () -- | See lua_rawgeti. rawgeti :: LuaState -> Int -> Int -> IO () -- | See lua_rawset. rawset :: LuaState -> Int -> IO () -- | See lua_rawseti. rawseti :: LuaState -> Int -> Int -> IO () -- | See lua_remove. remove :: LuaState -> Int -> IO () -- | See lua_replace. replace :: LuaState -> Int -> IO () -- | See lua_resume. resume :: LuaState -> Int -> IO Int -- | See lua_setfenv. setfenv :: LuaState -> Int -> IO Int -- | See lua_setmetatable. setmetatable :: LuaState -> Int -> IO () -- | See lua_settable. settable :: LuaState -> Int -> IO () -- | See lua_status. status :: LuaState -> IO Int -- | See lua_toboolean. toboolean :: LuaState -> Int -> IO Bool -- | See lua_tocfunction. tocfunction :: LuaState -> Int -> IO (FunPtr LuaCFunction) -- | See lua_tointeger. tointeger :: LuaState -> Int -> IO LuaInteger -- | See lua_tonumber. tonumber :: LuaState -> Int -> IO LuaNumber -- | See lua_topointer. topointer :: LuaState -> Int -> IO (Ptr ()) -- | See lua_register. register :: LuaState -> String -> FunPtr LuaCFunction -> IO () -- | See luaL_newmetatable. newmetatable :: LuaState -> String -> IO Int -- | See luaL_argerror. Contrary to the manual, Haskell function -- does return with value less than zero. argerror :: LuaState -> Int -> String -> IO CInt -- | See luaL_ref. ref :: LuaState -> Int -> IO Int -- | See luaL_unref. unref :: LuaState -> Int -> Int -> IO () -- | A value that can be pushed and poped from the Lua stack. All instances -- are natural, except following: -- -- class StackValue a -- | Pushes a value onto Lua stack, casting it into meaningfully nearest -- Lua type. push :: StackValue a => LuaState -> a -> IO () -- | Check if at index n there is a convertible Lua value and if -- so return it wrapped in Just. Return Nothing -- otherwise. peek :: StackValue a => LuaState -> Int -> IO (Maybe a) -- | Lua type id code of the vaule expected. Parameter is unused. valuetype :: StackValue a => a -> LTYPE maybepeek :: l -> n -> (l -> n -> IO Bool) -> (l -> n -> IO r) -> IO (Maybe r) -- | Like getglobal, but knows about packages. e. g. -- --
--   getglobal l "math.sin"
--   
-- -- returns correct result getglobal2 :: LuaState -> String -> IO () typenameindex :: LuaState -> Int -> IO String class LuaImport a luaimport' :: LuaImport a => Int -> a -> LuaCFunction luaimportargerror :: LuaImport a => Int -> String -> a -> LuaCFunction mkWrapper :: LuaCFunction -> IO (FunPtr LuaCFunction) -- | Create new foreign Lua function. Function created can be called by Lua -- engine. Remeber to free the pointer with freecfunction. newcfunction :: LuaImport a => a -> IO (FunPtr LuaCFunction) -- | Convert a Haskell function to Lua function. Any Haskell function can -- be converted provided that: -- -- -- -- Any Haskell exception will be converted to a string and returned as -- Lua error. luaimport :: LuaImport a => a -> LuaCFunction -- | Free function pointer created with newcfunction. freecfunction :: FunPtr LuaCFunction -> IO () class LuaCallProc a callproc' :: LuaCallProc a => LuaState -> String -> IO () -> Int -> a -- | Call a Lua procedure. Use as: -- --
--   callproc l "proc" "abc" (1::Int) (5.0::Double)
--   
callproc :: (LuaCallProc a) => LuaState -> String -> a class LuaCallFunc a callfunc' :: LuaCallFunc a => LuaState -> String -> IO () -> Int -> a -- | Call a Lua function. Use as: -- --
--   Just v <- callfunc l "proc" "abc" (1::Int) (5.0::Double)
--   
callfunc :: (LuaCallFunc a) => LuaState -> String -> a hsmethod__gc_addr :: FunPtr LuaCFunction hsmethod__call_addr :: FunPtr LuaCFunction hsmethod__gc :: LuaState -> IO CInt hsmethod__call :: LuaState -> IO CInt -- | Pushes Haskell function converted to a Lua function. All values -- created will be garbage collected. Use as: -- --
--   Lua.pushhsfunction l myfun
--   Lua.setglobal l "myfun"
--   
-- -- You are not allowed to use lua_error anywhere, but use an -- error code of (-1) to the same effect. Push error message as the sole -- return value. pushhsfunction :: LuaImport a => LuaState -> a -> IO () -- | Pushes _raw_ Haskell function converted to a Lua function. Raw Haskell -- functions collect parameters from the stack and return a CInt -- that represents number of return values left in the stack. pushrawhsfunction :: LuaState -> LuaCFunction -> IO () -- | Imports a Haskell function and registers it at global name. registerhsfunction :: LuaImport a => LuaState -> String -> a -> IO () -- | Imports a raw Haskell function and registers it at global name. registerrawhsfunction :: LuaState -> String -> (LuaState -> IO CInt) -> IO () instance GHC.Enum.Enum Scripting.Lua.GCCONTROL instance GHC.Show.Show Scripting.Lua.GCCONTROL instance GHC.Classes.Ord Scripting.Lua.GCCONTROL instance GHC.Classes.Eq Scripting.Lua.GCCONTROL instance GHC.Classes.Ord Scripting.Lua.LTYPE instance GHC.Show.Show Scripting.Lua.LTYPE instance GHC.Classes.Eq Scripting.Lua.LTYPE instance GHC.Enum.Enum Scripting.Lua.LTYPE instance Scripting.Lua.StackValue Scripting.Lua.Raw.LuaInteger instance Scripting.Lua.StackValue Scripting.Lua.Raw.LuaNumber instance Scripting.Lua.StackValue GHC.Types.Int instance Scripting.Lua.StackValue Data.ByteString.Internal.ByteString instance Scripting.Lua.StackValue a => Scripting.Lua.StackValue [a] instance Scripting.Lua.StackValue GHC.Types.Bool instance Scripting.Lua.StackValue (GHC.Ptr.FunPtr Scripting.Lua.Raw.LuaCFunction) instance Scripting.Lua.StackValue (GHC.Ptr.Ptr a) instance Scripting.Lua.StackValue Scripting.Lua.Raw.LuaState instance Scripting.Lua.StackValue () instance Scripting.Lua.StackValue a => Scripting.Lua.LuaImport (GHC.Types.IO a) instance (Scripting.Lua.StackValue a, Scripting.Lua.LuaImport b) => Scripting.Lua.LuaImport (a -> b) instance Scripting.Lua.LuaCallProc (GHC.Types.IO t) instance Scripting.Lua.StackValue t => Scripting.Lua.LuaCallFunc (GHC.Types.IO t) instance (Scripting.Lua.StackValue t, Scripting.Lua.LuaCallProc b) => Scripting.Lua.LuaCallProc (t -> b) instance (Scripting.Lua.StackValue t, Scripting.Lua.LuaCallFunc b) => Scripting.Lua.LuaCallFunc (t -> b)