hslua 0.4.0 → 0.4.1
raw patch · 4 files changed
+34/−7 lines, 4 filesdep +QuickCheckdep +quickcheck-instancesdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: QuickCheck, quickcheck-instances
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- README.md +13/−0
- hslua.cabal +6/−3
- src/Scripting/Lua.hsc +11/−4
CHANGELOG.md view
@@ -1,5 +1,9 @@ ## Changelog +### 0.4.1++* Bugfix(#30): `tolist` wasn't popping elements of the list from stack.+ ### 0.4.0 * `pushstring` and `tostring` now uses `ByteString` instead of `[Char]`.
+ README.md view
@@ -0,0 +1,13 @@+# hslua -- Lua interpreter interface for Haskell++[](https://travis-ci.org/osa1/hslua)+[](https://coveralls.io/github/osa1/hslua?branch=master)+[](https://hackage.haskell.org/package/hslua)++To use system-wide installed Lua/LuaJIT when linking hslua as a dependency, build/install your package using `--constraint="hslua +system-lua"` or for LuaJIT: `--constraint="hslua +system-lua +luajit"`. For example, you can install Pandoc with hslua that uses system-wide LuaJIT like this:++```+cabal install pandoc --constraint="hslua +system-lua +luajit"+```++(Note that `-fluajit` flag is added with hslua 0.3.14)
hslua.cabal view
@@ -1,5 +1,5 @@ name: hslua-version: 0.4.0+version: 0.4.1 stability: beta cabal-version: >= 1.8 license: MIT@@ -18,6 +18,7 @@ [Example programs](https://github.com/osa1/hslua/tree/master/examples) category: Scripting extra-source-files: lua-5.1.5/*.h+ README.md CHANGELOG.md COPYRIGHT examples/callbacks/callbacks.lua@@ -41,7 +42,7 @@ default: False library- build-depends: base == 4.*, bytestring >= 0.10 && < 0.11+ build-depends: base == 4.*, bytestring >= 0.10.2.0 && < 0.11 exposed-modules: Scripting.Lua, Scripting.Lua.Raw hs-source-dirs: src ghc-options: -Wall -O2@@ -121,4 +122,6 @@ hspec, hspec-contrib, HUnit,- text+ text,+ QuickCheck >= 2.7,+ quickcheck-instances
src/Scripting/Lua.hsc view
@@ -1,5 +1,10 @@ {-# LANGUAGE FlexibleInstances, ForeignFunctionInterface, ScopedTypeVariables #-} +-- In older versions of GHC, FlexibleInstances doesn't imply+-- TypeSynonymInstances, so we need to enable it explicitly.+-- See #29.+{-# LANGUAGE TypeSynonymInstances #-}+ module Scripting.Lua ( LuaState , LuaCFunction@@ -137,6 +142,7 @@ iter (i : is) = do rawgeti l n i ret <- peek l (-1)+ pop l 1 case ret of Nothing -> return Nothing Just val -> do@@ -638,11 +644,11 @@ Just v -> luaimport' (narg+1) (x v) l Nothing -> do t <- ltype l narg- exp <- typename l (valuetype (fromJust arg))+ expected <- typename l (valuetype (fromJust arg)) got <- typename l t luaimportargerror narg (Prelude.concat ["argument ", show narg, " of Haskell function: ",- exp, " expected, got ", got])+ expected, " expected, got ", got]) (x undefined) l foreign import ccall "wrapper" mkWrapper :: LuaCFunction -> IO (FunPtr LuaCFunction)@@ -714,10 +720,11 @@ case r of Just x -> return x Nothing -> do- exp <- typename l (valuetype (fromJust r))+ expected <- typename l (valuetype (fromJust r)) t <- ltype l (-1) got <- typename l t- fail ("Incorrect result type (" ++ exp ++ " expected, got " ++ got ++ ")")+ fail $ Prelude.concat+ [ "Incorrect result type (", expected, " expected, got ", got, ")" ] instance (StackValue t, LuaCallProc b) => LuaCallProc (t -> b) where callproc' l f a k x = callproc' l f (a >> push l x) (k+1)