-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Lua language interpreter embedding in Haskell -- @package hslua @version 0.4.1 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_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 () 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 in Lua Reference -- Manual. 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 -- | See LUA_MULTRET in Lua Reference Manual. multret :: Int -- | See lua_settop in Lua Reference Manual. settop :: LuaState -> Int -> IO () -- | See lua_createtable in Lua Reference Manual. createtable :: LuaState -> Int -> Int -> IO () -- | See lua_objlen in Lua Reference Manual. objlen :: LuaState -> Int -> IO Int -- | See lua_pop in Lua Reference Manual. pop :: LuaState -> Int -> IO () -- | See lua_newtable in Lua Reference Manual. newtable :: LuaState -> IO () -- | See lua_pushcclosure in Lua Reference Manual. pushcclosure :: LuaState -> FunPtr LuaCFunction -> Int -> IO () -- | See lua_pushcfunction in Lua Reference Manual. pushcfunction :: LuaState -> FunPtr LuaCFunction -> IO () -- | See lua_strlen in Lua Reference Manual. strlen :: LuaState -> Int -> IO Int -- | See lua_type in Lua Reference Manual. ltype :: LuaState -> Int -> IO LTYPE -- | See lua_isfunction in Lua Reference Manual. isfunction :: LuaState -> Int -> IO Bool -- | See lua_istable in Lua Reference Manual. 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 in Lua Reference Manual. islightuserdata :: LuaState -> Int -> IO Bool -- | See lua_isnil in Lua Reference Manual. isnil :: LuaState -> Int -> IO Bool -- | See lua_isboolean in Lua Reference Manual. isboolean :: LuaState -> Int -> IO Bool -- | See lua_isthread in Lua Reference Manual. isthread :: LuaState -> Int -> IO Bool -- | See lua_none in Lua Reference Manual. isnone :: LuaState -> Int -> IO Bool -- | See lua_noneornil in Lua Reference Manual. isnoneornil :: LuaState -> Int -> IO Bool -- | See LUA_REGISTRYINDEX in Lua Reference Manual. registryindex :: Int -- | See LUA_ENVIRONINDEX in Lua Reference Manual. environindex :: Int -- | See LUA_GLOBALSINDEX in Lua Reference Manual. globalsindex :: Int -- | See lua_upvalueindex in Lua Reference Manual. upvalueindex :: Int -> Int -- | See lua_atpanic in Lua Reference Manual. atpanic :: LuaState -> FunPtr LuaCFunction -> IO (FunPtr LuaCFunction) -- | See lua_tostring in Lua Reference Manual. tostring :: LuaState -> Int -> IO ByteString -- | See lua_tothread in Lua Reference Manual. tothread :: LuaState -> Int -> IO LuaState -- | See lua_touserdata in Lua Reference Manual. touserdata :: LuaState -> Int -> IO (Ptr a) -- | See lua_typename in Lua Reference Manual. typename :: LuaState -> LTYPE -> IO String -- | See lua_xmove in Lua Reference Manual. xmove :: LuaState -> LuaState -> Int -> IO () -- | See lua_yield in Lua Reference Manual. yield :: LuaState -> Int -> IO Int -- | See lua_checkstack in Lua Reference Manual. checkstack :: LuaState -> Int -> IO Bool -- | See lua_newstate and luaL_newstate in Lua Reference -- Manual. newstate :: IO LuaState -- | See lua_close in Lua Reference Manual. close :: LuaState -> IO () -- | See lua_concat in Lua Reference Manual. concat :: LuaState -> Int -> IO () -- | See lua_call and lua_call in Lua Reference Manual. call :: LuaState -> Int -> Int -> IO () -- | See lua_pcall in Lua Reference Manual. pcall :: LuaState -> Int -> Int -> Int -> IO Int -- | See lua_cpcall in Lua Reference Manual. cpcall :: LuaState -> FunPtr LuaCFunction -> Ptr a -> IO Int -- | See lua_getfield in Lua Reference Manual. getfield :: LuaState -> Int -> String -> IO () -- | See lua_setfield in Lua Reference Manual. setfield :: LuaState -> Int -> String -> IO () -- | See lua_getglobal in Lua Reference Manual. getglobal :: LuaState -> String -> IO () -- | See lua_setglobal in Lua Reference Manual. setglobal :: LuaState -> String -> IO () -- | See luaL_openlibs in Lua Reference Manual. openlibs :: LuaState -> IO () mkStringWriter :: LuaWriter -> IO (FunPtr LuaWriter) -- | See lua_dump in Lua Reference Manual. dump :: LuaState -> IO String -- | See lua_equal in Lua Reference Manual. equal :: LuaState -> Int -> Int -> IO Bool -- | This is a convenience function to implement error propagation -- convention described in [Error handling in hslua](#g:1). hslua doesn't -- implement lua_error function from Lua C API because it's -- never safe to use. (see [Error handling in hslua](#g:1) for details) lerror :: LuaState -> IO Int -- | See lua_gc in Lua Reference Manual. gc :: LuaState -> GCCONTROL -> Int -> IO Int -- | See lua_getfenv in Lua Reference Manual. getfenv :: LuaState -> Int -> IO () -- | See lua_getmetatable in Lua Reference Manual. getmetatable :: LuaState -> Int -> IO Bool -- | See lua_gettable in Lua Reference Manual. gettable :: LuaState -> Int -> IO () -- | See lua_gettop in Lua Reference Manual. gettop :: LuaState -> IO Int -- | See lua_insert in Lua Reference Manual. insert :: LuaState -> Int -> IO () -- | See lua_iscfunction in Lua Reference Manual. iscfunction :: LuaState -> Int -> IO Bool -- | See lua_isnumber in Lua Reference Manual. isnumber :: LuaState -> Int -> IO Bool -- | See lua_isstring in Lua Reference Manual. isstring :: LuaState -> Int -> IO Bool -- | See lua_isuserdata in Lua Reference Manual. isuserdata :: LuaState -> Int -> IO Bool -- | See lua_lessthan in Lua Reference Manual. lessthan :: LuaState -> Int -> Int -> IO Bool -- | See luaL_loadfile in Lua Reference Manual. loadfile :: LuaState -> String -> IO Int mkStringReader :: LuaReader -> IO (FunPtr LuaReader) -- | See luaL_loadstring in Lua Reference Manual. loadstring :: LuaState -> String -> String -> IO Int -- | See lua_newthread in Lua Reference Manual. newthread :: LuaState -> IO LuaState -- | See lua_newuserdata in Lua Reference Manual. newuserdata :: LuaState -> Int -> IO (Ptr ()) -- | See lua_next in Lua Reference Manual. next :: LuaState -> Int -> IO Bool -- | See lua_pushboolean in Lua Reference Manual. pushboolean :: LuaState -> Bool -> IO () -- | See lua_pushinteger in Lua Reference Manual. pushinteger :: LuaState -> LuaInteger -> IO () -- | See lua_pushlightuserdata in Lua Reference Manual. pushlightuserdata :: LuaState -> Ptr a -> IO () -- | See lua_pushnil in Lua Reference Manual. pushnil :: LuaState -> IO () -- | See lua_pushnumber in Lua Reference Manual. pushnumber :: LuaState -> LuaNumber -> IO () -- | See lua_pushstring in Lua Reference Manual. pushstring :: LuaState -> ByteString -> IO () -- | Push a list to Lua stack as a Lua array. pushlist :: StackValue a => LuaState -> [a] -> IO () -- | See lua_pushthread in Lua Reference Manual. pushthread :: LuaState -> IO Bool -- | See lua_pushvalue in Lua Reference Manual. pushvalue :: LuaState -> Int -> IO () -- | See lua_rawequal in Lua Reference Manual. rawequal :: LuaState -> Int -> Int -> IO Bool -- | See lua_rawget in Lua Reference Manual. rawget :: LuaState -> Int -> IO () -- | See lua_rawgeti in Lua Reference Manual. rawgeti :: LuaState -> Int -> Int -> IO () -- | See lua_rawset in Lua Reference Manual. rawset :: LuaState -> Int -> IO () -- | See lua_rawseti in Lua Reference Manual. rawseti :: LuaState -> Int -> Int -> IO () -- | See lua_remove in Lua Reference Manual. remove :: LuaState -> Int -> IO () -- | See lua_replace in Lua Reference Manual. replace :: LuaState -> Int -> IO () -- | See lua_resume in Lua Reference Manual. resume :: LuaState -> Int -> IO Int -- | See lua_setfenv in Lua Reference Manual. setfenv :: LuaState -> Int -> IO Int -- | See lua_setmetatable in Lua Reference Manual. setmetatable :: LuaState -> Int -> IO () -- | See lua_settable in Lua Reference Manual. settable :: LuaState -> Int -> IO () -- | See lua_status in Lua Reference Manual. status :: LuaState -> IO Int -- | See lua_toboolean in Lua Reference Manual. toboolean :: LuaState -> Int -> IO Bool -- | See lua_tocfunction in Lua Reference Manual. tocfunction :: LuaState -> Int -> IO (FunPtr LuaCFunction) -- | See lua_tointeger in Lua Reference Manual. tointeger :: LuaState -> Int -> IO LuaInteger -- | See lua_tonumber in Lua Reference Manual. tonumber :: LuaState -> Int -> IO LuaNumber -- | See lua_topointer in Lua Reference Manual. topointer :: LuaState -> Int -> IO (Ptr ()) -- | See lua_register in Lua Reference Manual. register :: LuaState -> String -> FunPtr LuaCFunction -> IO () -- | See luaL_newmetatable in Lua Reference Manual. newmetatable :: LuaState -> String -> IO Int -- | See luaL_argerror in Lua Reference Manual. Contrary to the -- manual, Haskell function does return with value less than zero. argerror :: LuaState -> Int -> String -> IO CInt -- | See luaL_ref in Lua Reference Manual. ref :: LuaState -> Int -> IO Int -- | See luaL_unref in Lua Reference Manual. unref :: LuaState -> Int -> Int -> IO () -- | A value that can be pushed and poped from the Lua stack. All instances -- are natural, except following: -- --
-- 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: -- --
-- 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 Eq LTYPE instance Show LTYPE instance Ord LTYPE instance Eq GCCONTROL instance Ord GCCONTROL instance Show GCCONTROL instance Enum GCCONTROL instance (StackValue t, LuaCallFunc b) => LuaCallFunc (t -> b) instance (StackValue t, LuaCallProc b) => LuaCallProc (t -> b) instance StackValue t => LuaCallFunc (IO t) instance LuaCallProc (IO t) instance (StackValue a, LuaImport b) => LuaImport (a -> b) instance StackValue a => LuaImport (IO a) instance StackValue () instance StackValue LuaState instance StackValue (Ptr a) instance StackValue (FunPtr LuaCFunction) instance StackValue Bool instance StackValue a => StackValue [a] instance StackValue ByteString instance StackValue Int instance StackValue LuaNumber instance StackValue LuaInteger instance Enum LTYPE