hslua 0.3.2 → 0.3.3
raw patch · 3 files changed
+16/−16 lines, 3 files
Files
- hslua.cabal +1/−1
- src/Scripting/Lua.hs +1/−1
- src/Scripting/Lua/ConfigFile.hs +14/−14
hslua.cabal view
@@ -1,5 +1,5 @@ Name: hslua-Version: 0.3.2+Version: 0.3.3 Stability: beta Cabal-version: >= 1.6 License: BSD3
src/Scripting/Lua.hs view
@@ -212,7 +212,6 @@ | TBOOLEAN | TLIGHTUSERDATA | TNUMBER - fromEnum TFUNCTION = 6 | TSTRING | TTABLE | TFUNCTION @@ -228,6 +227,7 @@ fromEnum TNUMBER = 3 fromEnum TSTRING = 4 fromEnum TTABLE = 5 + fromEnum TFUNCTION = 6 fromEnum TUSERDATA = 7 fromEnum TTHREAD = 8 toEnum (-1) = TNONE
src/Scripting/Lua/ConfigFile.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveDataTypeable #-} -- | -- Module : Scripting.Lua.ConfigFile@@ -65,7 +65,7 @@ -- | Returns a boolean value from a configuration file. Returns @False@ -- if the value is not defined in the file. Example:---+-- -- > someVal = true getBool :: Config -> String -> IO Bool getBool (Config l) name = do@@ -78,7 +78,7 @@ -- | Returns a string value from a configuration file. Returns the -- empty string if the value is not defined in the file. Example:---+-- -- > someVal = "foo" getString :: Config -> String -> IO String getString (Config l) name = do@@ -90,7 +90,7 @@ "expected string value: " ++ name -- | Returns an integer value from a configuration file. Example:---+-- -- > someVal = 2 getInt :: Config -> String -> IO (Maybe Int) getInt (Config l) name = do@@ -102,7 +102,7 @@ "expected numeric value: " ++ name -- | Returns a double value from a configuration file. Example:---+-- -- > someVal = 3.1415926 getDouble :: Config -> String -> IO (Maybe Double) getDouble (Config l) name = do@@ -116,7 +116,7 @@ -- | Returns a list of strings (i.e. a Lua table in which the keys -- are integers and the values are strings) from a configuration file. -- Example:---+-- -- > someVal = { "foo", "bar", "baz" } getList :: Config -> String -> IO [String] getList (Config l) name =@@ -125,7 +125,7 @@ -- | Returns a list of lists, i.e. a Lua table of tables. In the outer -- table, the keys are integers and the values are tables, and in the inner -- tables, the keys are integers and the values are strings. Example:---+-- -- > someVal = { -- > { "foo one", "foo two", "foo three" }, -- > { "bar one", "bar two", "bar three" }@@ -136,7 +136,7 @@ -- | Returns an association list, i.e. a Lua table in which the keys -- and values are strings. Example:---+-- -- > someVal = { -- > one = "foo", -- > two = "bar",@@ -149,7 +149,7 @@ -- | Returns a list of association lists, i.e. a Lua table of tables. -- In the outer table, the keys are integers and the values are tables, -- and in the inner tables, the keys and values are strings. Example:---+-- -- > someVal = { -- > { -- > foo = "aaa",@@ -170,7 +170,7 @@ -- of tables. In the outer table, the keys are strings and the values -- are tables, and in the inner tables, the keys and values are strings. -- Example:---+-- -- > someVal = { -- > something = { -- > foo = "aaa",@@ -194,13 +194,13 @@ Gets a Lua global and pops it off the Lua stack. -}-getGlobalVal l name = do+getGlobalVal l name = do Lua.getglobal l name val <- Lua.peek l (-1) valType <- Lua.ltype l (-1) Lua.pop l 1 return (val, valType)-+ {- Checks whether a value can be converted to a string.@@ -228,11 +228,11 @@ return items Lua.TNIL -> return [] _ -> throwIO $ ConfigFileException $ "expected table: " ++ name-+ {- -Iterates over the elements of a Lua table whose keys are integers,+Iterates over the elements of a Lua table whose keys are integers, performs some action on each element, and returns the results as a list.