packages feed

hslua-core 2.0.0.1 → 2.0.0.2

raw patch · 4 files changed

+21/−8 lines, 4 filesdep ~luaPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: lua

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -4,6 +4,14 @@  [1]: https://pvp.haskell.org +## hslua-core 2.0.0.2++Released 2021-11-03.++- Fixed output of `pushTypeMismatchError` when there is no value+  at the given index. Previously the function would report the+  value as type `string` and now reports it as `no value`.+ ## hslua-core 2.0.0.1  Released 2021-10-29.
hslua-core.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                hslua-core-version:             2.0.0.1+version:             2.0.0.2 synopsis:            Bindings to Lua, an embeddable scripting language description:         Wrappers and helpers to bridge Haskell and                      <https://www.lua.org/ Lua>.@@ -38,7 +38,7 @@   build-depends:       base          >= 4.8    && < 5                      , bytestring    >= 0.10.2 && < 0.12                      , exceptions    >= 0.8    && < 0.11-                     , lua           >= 2.0    && < 2.1+                     , lua           >= 2.0.1  && < 2.1                      , mtl           >= 2.2    && < 2.3                      , text          >= 1.0    && < 1.3   ghc-options:         -Wall
src/HsLua/Core/Error.hs view
@@ -200,14 +200,14 @@                       -> StackIndex  -- ^ stack index of mismatching object                       -> LuaE e () pushTypeMismatchError expected idx = liftLua $ \l -> do-  idx' <- lua_absindex l idx+  let pushtype = lua_type l idx >>= lua_typename l >>= lua_pushstring l+  B.unsafeUseAsCString "__name" (luaL_getmetafield l idx) >>= \case+    LUA_TSTRING -> return () -- pushed the name+    LUA_TNIL    -> void pushtype+    _           -> lua_pop l 1 <* pushtype   let pushstring str = B.unsafeUseAsCStringLen str $ \(cstr, cstrLen) ->         lua_pushlstring l cstr (fromIntegral cstrLen)-  let pushtype = lua_type l idx' >>= lua_typename l >>= lua_pushstring l   pushstring expected   pushstring " expected, got "-  B.unsafeUseAsCString "__name" (luaL_getmetafield l idx') >>= \case-    LUA_TSTRING -> return () -- pushed the name-    LUA_TNIL    -> void pushtype-    _           -> lua_pop l 1 <* pushtype+  lua_rotate l (-3) (-1)  -- move actual type to the end   lua_concat l 3
test/HsLua/Core/ErrorTests.hs view
@@ -60,6 +60,11 @@         Lua.newudmetatable "Foo"         Lua.setmetatable (Lua.nth 2)         throwTypeMismatchError "Bar" Lua.top :: Lua ()++    , "missing value" =:+      "boolean expected, got no value" `shouldBeErrorMessageOf` do+        curtop <- Lua.gettop+        throwTypeMismatchError "boolean" (curtop + 1) :: Lua ()     ]   ]