Module:table/sortedPairs
පෙනුම
- මෙම module සතුව උපදෙස් උප පිටුවක් නොපවතියි. Please නිර්මාණය කරන්න.
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
local table_keys_to_list_module = "Module:table/keysToList"
local function keys_to_list(...)
keys_to_list = require(table_keys_to_list_module)
return keys_to_list(...)
end
--[==[
Iterates through a table, with the keys sorted using the keysToList function.
If there are only numerical keys, `export.sparseIpairs` is probably faster.]==]
return function(t, key_sort)
local list, i = keys_to_list(t, key_sort), 0
return function()
i = i + 1
local k = list[i]
if k ~= nil then
return k, t[k]
end
end
end