mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
Changed lume.set() to make use of lume.invert()
This commit is contained in:
parent
2c71079ef3
commit
1bbb795a89
6
lume.lua
6
lume.lua
@ -134,10 +134,10 @@ end
|
||||
|
||||
|
||||
function lume.set(t, retainkeys)
|
||||
local tmp = {}
|
||||
for k, v in pairs(t) do tmp[v] = k end
|
||||
local rtn = {}
|
||||
for k, v in pairs(tmp) do rtn[retainkeys and v or (#rtn + 1)] = k end
|
||||
for k, v in pairs(lume.invert(t)) do
|
||||
rtn[retainkeys and v or (#rtn + 1)] = k
|
||||
end
|
||||
return rtn
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user