luautils 0.1.2 → 0.1.3
raw patch · 5 files changed
+45/−46 lines, 5 filesdep ~text
Dependency ranges changed: text
Files
- README +0/−23
- README.md +24/−0
- luautils.cabal +6/−4
- src/Scripting/LuaUtils.hs +1/−12
- tests/simple.hs +14/−7
− README
@@ -1,23 +0,0 @@-LuaUtils (luautils-0.1.2)-=========================--This package is an add-on to the @HsLua@ package by Gracjan Polak (http://hackage.haskell.org/package/hslua).--HsLua only provides a very bare-bones wrapper over the Lua API, and this package is meant to fill in the gap by providing some commonly used features.--Currently the following features are provided ---1. @Lua.StackValue@ instances for a variety of commonly used datatypes, such as Lists, Maps, Tuples, Either, Maybe etc.-2. @luaDoString@ and @luaDoFile@ utility functions.-3. @dumpStack@ function to dump the contents of the stack for debugging.---Changelog-=========--0.1 : Intial release-0.1.1.0 : Added a Lua.StackValue instance for Text and Data.Map-0.1.1.1 : No Changes. Bumped version number for upload to Hackage-0.1.1.2 : Fixed bug with the StackValue instance for lists-0.1.2 : HsLua 0.3.9 compatibility; LuaDoFile and LuaDoString now return `IO ()` instead of `IO Int`-
+ README.md view
@@ -0,0 +1,24 @@+LuaUtils (luautils-0.1.3)+=========================++This package is an add-on to the @HsLua@ package by Gracjan Polak (http://hackage.haskell.org/package/hslua).++HsLua only provides a very bare-bones wrapper over the Lua API, and this package is meant to fill in the gap by providing some commonly used features.++Currently the following features are provided -++1. @Lua.StackValue@ instances for a variety of commonly used datatypes, such as Lists, Maps, Tuples, Either, Maybe etc.+2. @luaDoString@ and @luaDoFile@ utility functions.+3. @dumpStack@ function to dump the contents of the stack for debugging.+++Changelog+=========++0.1 : Intial release+0.1.1.0 : Added a Lua.StackValue instance for Text and Data.Map+0.1.1.1 : No Changes. Bumped version number for upload to Hackage+0.1.1.2 : Fixed bug with the StackValue instance for lists+0.1.2 : HsLua 0.3.9 compatibility; LuaDoFile and LuaDoString now return `IO ()` instead of `IO Int`+0.1.3 : Fixed bug with StackValue.peek for Tuples+
luautils.cabal view
@@ -1,5 +1,5 @@ Name: luautils-Version: 0.1.2+Version: 0.1.3 Synopsis: Helpers for Haskell integration with Lua Description: This package is an add-on to the @HsLua@ package by Gracjan Polak. HsLua only provides a very bare-bones wrapper over the Lua API, and this@@ -12,7 +12,7 @@ Cabal-version: >=1.8 stability: Experimental Category: Scripting-Extra-source-files: README+Extra-source-files: README.md source-repository head type: git@@ -20,8 +20,8 @@ source-repository this type: git- location: http://github.com/ajnsit/luautils/tree/v0.1.2- tag: v0.1.2+ location: http://github.com/ajnsit/luautils/tree/v0.1.3+ tag: v0.1.3 Library hs-source-dirs: src@@ -45,5 +45,7 @@ , test-framework-quickcheck2 , quickcheck-instances , containers+ , text hs-source-dirs: tests+ ghc-options: -w -threaded -rtsopts -with-rtsopts=-N -O0 -Wall
src/Scripting/LuaUtils.hs view
@@ -124,21 +124,10 @@ Lua.pop l 1 Lua.next l ix Just b <- Lua.peek l (-1)- Lua.pop l 1+ Lua.pop l 2 return $ Just (a,b) valuetype _ = Lua.TUSERDATA--test :: IO ()-test = do- l <- Lua.newstate- Lua.push l (True,False,True,False,True)- dumpStack l- {-- (x::Maybe (Bool,Bool)) <- Lua.peek l (-1)- dumpStack l- -}- -- | Stackvalue instance for triples instance (Lua.StackValue a, Lua.StackValue b, Lua.StackValue c) => Lua.StackValue (a,b,c)
tests/simple.hs view
@@ -9,7 +9,7 @@ import Test.QuickCheck.Instances import Data.Map (Map)-import qualified Data.Map as Map+import Data.Text (Text) import qualified Scripting.Lua as Lua import Scripting.LuaUtils@@ -29,15 +29,22 @@ -- TODO: Write more tests prop_lists :: [Int] -> Property prop_lists = testStackValueInstance-prop_tuple :: (Int,Int) -> Property-prop_tuple = testStackValueInstance+prop_double :: (Int,Int) -> Property+prop_double = testStackValueInstance+prop_triple :: (Int,Int,Int) -> Property+prop_triple = testStackValueInstance+prop_quadruple :: (Int,Int,Int,Int) -> Property+prop_quadruple = testStackValueInstance prop_maps :: Map Int Int -> Property prop_maps = testStackValueInstance+prop_text :: Text -> Property+prop_text = testStackValueInstance main :: IO () main = do- verboseCheck prop_lists- verboseCheck prop_tuple- verboseCheck prop_maps--- main = $defaultMainGenerator+ verboseCheck prop_triple+-- verboseCheck prop_tuple+-- verboseCheck prop_maps+-- verboseCheck prop_text+--main = $defaultMainGenerator