hslua 0.3.10 → 0.3.11
raw patch · 3 files changed
+18/−8 lines, 3 files
Files
- hslua.cabal +1/−1
- src/Scripting/Lua.hs +15/−5
- src/Scripting/Lua/ConfigFile.hs +2/−2
hslua.cabal view
@@ -1,5 +1,5 @@ Name: hslua-Version: 0.3.10+Version: 0.3.11 Stability: beta Cabal-version: >= 1.8 License: MIT
src/Scripting/Lua.hs view
@@ -5,9 +5,9 @@ -- Module : Scripting.Lua -- Copyright : (c) Gracjan Polak 2007 -- --- License : BSD3-style +-- License : MIT -- --- Maintainer : gracjanpolak@gmail.com +-- Maintainer : omeragacan@gmail.com -- Stability : alpha -- Portability : portable, ffi -- @@ -163,6 +163,8 @@ loadstring, newmetatable, argerror, + ref, + unref, -- * Haskell extensions StackValue(..), @@ -366,9 +368,11 @@ foreign import ccall "lauxlib.h luaL_newstate" c_luaL_newstate :: IO LuaState foreign import ccall "lauxlib.h luaL_newmetatable" c_luaL_newmetatable :: LuaState -> Ptr CChar -> IO CInt foreign import ccall "lauxlib.h luaL_argerror" c_luaL_argerror :: LuaState -> CInt -> Ptr CChar -> IO CInt +foreign import ccall "lauxlib.h luaL_ref" c_luaL_ref :: LuaState -> CInt -> IO CInt +foreign import ccall "lauxlib.h luaL_unref" c_luaL_unref :: LuaState -> CInt -> CInt -> IO () foreign import ccall "ntrljmp.h lua_neutralize_longjmp" c_lua_neutralize_longjmp :: LuaState -> IO CInt -foreign import ccall "ntrljmp.h &lua_neutralize_longjmp" c_lua_neutralize_longjmp_addr :: FunPtr (LuaState -> IO CInt) +foreign import ccall "ntrljmp.h &lua_neutralize_longjmp" c_lua_neutralize_longjmp_addr :: FunPtr (LuaState -> IO CInt) -- | See @lua_settop@ in Lua Reference Manual. @@ -530,7 +534,7 @@ --- | See @lua_call@ and @lua_call@ in Lua Reference Manual. This is +-- | See @lua_call@ and @lua_call@ in Lua Reference Manual. This is -- a wrapper over @lua_pcall@, as @lua_call@ is unsafe in controlled environment -- like Haskell VM. call :: LuaState -> Int -> Int -> IO () @@ -792,7 +796,7 @@ newmetatable :: LuaState -> String -> IO Int newmetatable l s = withCString s $ \s -> liftM fromIntegral (c_luaL_newmetatable l s) --- | See @luaL_argerror@ in Lua Reference Manual. Contrary to the +-- | 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 argerror l n msg = withCString msg $ \msg -> do @@ -803,7 +807,13 @@ -- here we should have error message string on top of the stack return (-1) +-- | See @luaL_ref@ in Lua Reference Manual. +ref :: LuaState -> Int -> IO Int +ref l n = fmap fromIntegral $ c_luaL_ref l (fromIntegral n) +-- | See @luaL_unref@ in Lua Reference Manual. +unref :: LuaState -> Int -> Int -> IO () +unref l t ref = c_luaL_unref l (fromIntegral t) (fromIntegral ref) -- | A value that can be pushed and poped from the Lua stack. -- All instances are natural, except following:
src/Scripting/Lua/ConfigFile.hs view
@@ -4,9 +4,9 @@ -- Module : Scripting.Lua.ConfigFile -- Copyright : (c) Benjamin Geer 2011, 2013 ----- License : BSD3-style+-- License : MIT ----- Maintainer : benjamin.geer@gmail.com+-- Maintainer : omeragacan@gmail.com -- Stability : alpha -- Portability : portable, ffi --