ElEditors, Interface administrators, Administrators
70,893
edits
m (change fillTemplate fallback) |
No edit summary |
||
Line 53: | Line 53: | ||
function spairs(t) | function spairs(t) | ||
local keys = {} | local keys = {} | ||
for k in pairs(t) do | for k in pairs(t) do keys[#keys + 1] = k end | ||
table.sort(keys, function(a, b) return #a == #b and a < b or #a < #b end) | |||
table.sort(keys) | |||
local i = 0 | local i = 0 | ||
return function() | return function() | ||
i = i + 1 | i = i + 1 | ||
return keys[i], t[keys[i]] | |||
end | end | ||
end | end |