Module:TableTools: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
138 bytes added ,  15 December 2013
finish sparseIpairs
(add getNumKeys function and improve the comments, add the beginnings of a sparseIpairs function)
(finish sparseIpairs)
Line 72: Line 72:
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--]]
--]]
-- function p.sparseIpairs(t)
function p.sparseIpairs(t)
-- local nums = p.getNumKeys(t)
local nums = p.getNumKeys(t)
local i = 0
local lim = #nums
return function ()
i = i + 1
if i <= lim then
local key = nums[i]
return key, t[key]
end
end
end


return p
return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.