1
0
mirror of https://github.com/kepler155c/opus synced 2025-12-18 22:28:06 +00:00

input redo + env pollution

This commit is contained in:
kepler155c@gmail.com
2017-10-20 04:23:17 -04:00
parent fb0f3e567a
commit 31b3787695
9 changed files with 84 additions and 67 deletions

View File

@@ -141,7 +141,7 @@ function Util.key(t, value)
end
function Util.keys(t)
local keys = {}
local keys = { }
for k in pairs(t) do
keys[#keys+1] = k
end
@@ -283,6 +283,19 @@ function Util.each(list, func)
end
end
function Util.rpairs(t)
local tkeys = Util.keys(t)
local i = #tkeys
return function()
local key = tkeys[i]
local k,v = key, t[key]
i = i - 1
if v then
return k, v
end
end
end
-- http://stackoverflow.com/questions/15706270/sort-a-table-in-lua
function Util.spairs(t, order)
local keys = Util.keys(t)