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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user