Debian Codegraph @

3rdparty/toluapp/src/bin/lua/ordered_pairs.lua

raw
1 local P = {}
2 op = P
3
4 function P:ordered_pairs(t)
5 local i = {}
6 for k in next, t do
7 table.insert(i, k)
8 end
9 table.sort(i)
10 return function()
11 local k = table.remove(i)
12 if k ~= nil then
13 return k, t[k]
14 end
15 end
16 end
17
18 return op