hslua-list 1.1.2 → 1.1.3
raw patch · 4 files changed
+33/−3 lines, 4 filesdep ~hslua-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hslua-core
API changes (from Hackage documentation)
Files
- CHANGELOG.md +13/−0
- cbits/listmod.c +9/−1
- hslua-list.cabal +2/−2
- test/test-list.lua +9/−0
CHANGELOG.md view
@@ -2,6 +2,19 @@ `hslua-list` uses [PVP Versioning](https://pvp.haskell.org). +## hslua-list-1.1.3++Released 2024-09-26.++- Fixed a bug that prevented `List.filter` to be used on tables+ that don't have a metatable.++- Added a stub function to ensure that the module can be+ compiled against Lua 5.3.++- Lowered the lower bound for hslua-core, allowing hslua-core+ 2.1.+ ## hslua-list-1.1.2 Released 2024-09-20.
cbits/listmod.c view
@@ -12,6 +12,14 @@ #define LUA_LOADED_TABLE "_LOADED" #endif +/* compatibility with older Lua versions (pre 5.4) */+#if LUA_VERSION_NUM < 504+/* non-functional replacement for lua_toclose */+static void lua_toclose(lua_State *L, int index) {+ return;+}+#endif+ /* ** Placeholder function. */@@ -203,7 +211,7 @@ luaL_checkstack(L, 4, NULL); lua_Integer len = luaL_len(L, 1); lua_createtable(L, len, 0); /* create new table */- lua_getmetatable(L, 1);+ lua_getmetatable(L, 1) || luaL_getmetatable(L, LIST_T); /* ensure mt */ lua_setmetatable(L, 3); for (lua_Integer i = 1, j = 0; i <= len; i++) { lua_pushvalue(L, 2); /* push predicate function */
hslua-list.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: hslua-list-version: 1.1.2+version: 1.1.3 synopsis: Opinionated, but extensible Lua list type. description: List type for Lua, with a Haskell interface. homepage: https://hslua.org/@@ -33,7 +33,7 @@ common common-options build-depends: base >= 4.9.1 && < 5- , hslua-core >= 2.2 && < 2.4+ , hslua-core >= 2.1 && < 2.4 ghc-options: -Wall -Wcompat -Widentities
test/test-list.lua view
@@ -101,6 +101,15 @@ 'bad argument %#1 to \'filter\' %(function expected, got table%)' ) end),+ test('can be used with metatable-less tables', function ()+ assert.are_same(+ List{64, 256},+ List.filter({64, 127, 256}, function (x)+ local lb = math.log(x, 2)+ return lb == math.floor(lb)+ end)+ )+ end) }, group 'find' {