모듈:table/sortedPairs
보이기
< 모듈:table
이 모듈에 대한 설명문서는 모듈:table/sortedPairs/설명문서에서 만들 수 있습니다
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