From b57d52a2aea010ffdeba5dc928b8c60c0fba5ff0 Mon Sep 17 00:00:00 2001 From: Emik Date: Fri, 20 Feb 2026 18:54:33 +0100 Subject: [PATCH] Use original keys for where --- src/lib/funky.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/funky.lua b/src/lib/funky.lua index 1d14a60..8c4b3ab 100644 --- a/src/lib/funky.lua +++ b/src/lib/funky.lua @@ -153,21 +153,18 @@ end ---@return F|{ [K]: V } ---@nodiscard function f:where(func) - local i = 0 - return f.new(function() local k, v while true do k, v = self:next() - if k == nil then + if k ~= nil then return end if func(v, k) then - i = i + 1 - return i, v + return k, v end end end) @@ -416,7 +413,7 @@ return function(tbl, fpairs, step) local stop = not fpairs and tbl or (type(fpairs) == "number") and fpairs or error("Invalid argument type for 'fpairs': " .. type(fpairs)) - if step ~= 0 and ((step < 0) == (start < stop)) then + if step and step ~= 0 and ((step < 0) == (start < stop)) then return none end