packages feed

hslua-module-system 0.2.0 → 0.2.1

raw patch · 4 files changed

+27/−52 lines, 4 filesdep ~hsluaPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hslua

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,9 +1,14 @@ # Revision history for hslua-module-system +## 0.2.1 -- 2019-05-04++- Use module helpers made available with HsLua 1.0.3. This avoids+  code duplication when used with other hslua modules.+ ## 0.2.0 -- 2019-05-01 -All fields and functions are now exported from the Haskell module under-the same name as that used in Lua.+All fields and functions are now exported from the Haskell module+under the same name as that used in Lua.  ### New fields 
hslua-module-system.cabal view
@@ -1,5 +1,5 @@ name:                hslua-module-system-version:             0.2.0+version:             0.2.1 synopsis:            Lua module wrapper around Haskell's System module.  description:         Provides access to system information and functionality@@ -31,7 +31,7 @@                      , containers >= 0.5    && < 0.7                      , directory  >= 1.3    && < 1.4                      , exceptions >= 0.8    && < 0.11-                     , hslua      >= 1.0    && < 1.2+                     , hslua      >= 1.0.3  && < 1.2                      , temporary  >= 1.2    && < 1.4   default-extensions:  LambdaCase   default-language:    Haskell2010
src/Foreign/Lua/Module/System.hs view
@@ -59,29 +59,28 @@ pushModule :: Lua NumResults pushModule = do   Lua.newtable-  addField "arch" arch-  addField "compiler_name" compiler_name-  addField "compiler_version" compiler_version-  addField "os" os-  addFunction "env" env-  addFunction "getenv" getenv-  addFunction "getwd" getwd-  addFunction "ls" ls-  addFunction "mkdir" mkdir-  addFunction "rmdir" rmdir-  addFunction "setenv" setenv-  addFunction "setwd" setwd-  addFunction "tmpdirname" tmpdirname-  addFunction "with_env" with_env-  addFunction "with_tmpdir" with_tmpdir-  addFunction "with_wd" with_wd+  Lua.addfield "arch" arch+  Lua.addfield "compiler_name" compiler_name+  Lua.addfield "compiler_version" compiler_version+  Lua.addfield "os" os+  Lua.addfunction "env" env+  Lua.addfunction "getenv" getenv+  Lua.addfunction "getwd" getwd+  Lua.addfunction "ls" ls+  Lua.addfunction "mkdir" mkdir+  Lua.addfunction "rmdir" rmdir+  Lua.addfunction "setenv" setenv+  Lua.addfunction "setwd" setwd+  Lua.addfunction "tmpdirname" tmpdirname+  Lua.addfunction "with_env" with_env+  Lua.addfunction "with_tmpdir" with_tmpdir+  Lua.addfunction "with_wd" with_wd   return 1  -- | Add the @system@ module under the given name to the table of -- preloaded packages. preloadModule :: String -> Lua ()-preloadModule = flip addPackagePreloader pushModule-+preloadModule = flip Lua.preloadhs pushModule  -- -- Fields
src/Foreign/Lua/Module/SystemUtils.hs view
@@ -11,9 +11,6 @@ module Foreign.Lua.Module.SystemUtils   ( AnyValue (..)   , Callback (..)-  , addPackagePreloader-  , addField-  , addFunction   , invoke   , invokeWithFilePath   , ioToLua@@ -21,34 +18,8 @@ where  import Control.Exception (IOException, try)-import Foreign.Lua (Lua, NumResults(..), Peekable, Pushable,-                    StackIndex, ToHaskellFunction)-+import Foreign.Lua (Lua, NumResults(..), Peekable, Pushable, StackIndex) import qualified Foreign.Lua as Lua---- | Registers a preloading function. Takes an module name and the Lua--- operation which produces the package.-addPackagePreloader :: String -> Lua NumResults -> Lua ()-addPackagePreloader name modulePusher = do-  Lua.getfield Lua.registryindex Lua.preloadTableRegistryField-  Lua.pushHaskellFunction modulePusher-  Lua.setfield (-2) name-  Lua.pop 1---- | Add a string-indexed field to the table at the top of the stack.-addField :: Pushable a => String -> a -> Lua ()-addField name value = do-  Lua.push name-  Lua.push value-  Lua.rawset (Lua.nthFromTop 3)---- | Attach a function to the table at the top of the stack, using the--- given name.-addFunction :: ToHaskellFunction a => String -> a -> Lua ()-addFunction name fn = do-  Lua.push name-  Lua.pushHaskellFunction fn-  Lua.rawset (-3)  -- | Lua callback function newtype Callback = Callback StackIndex