mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 02:52:21 +00:00
Added lume.remove() and tests
This commit is contained in:
17
lume.lua
17
lume.lua
@@ -158,6 +158,23 @@ function lume.push(t, ...)
|
||||
end
|
||||
|
||||
|
||||
function lume.remove(t, x)
|
||||
local iter = getiter(t)
|
||||
for i, v in iter(t) do
|
||||
if v == x then
|
||||
if isarray(t) then
|
||||
table.remove(t, i)
|
||||
break
|
||||
else
|
||||
t[i] = nil
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return x
|
||||
end
|
||||
|
||||
|
||||
function lume.shuffle(t)
|
||||
local rtn = {}
|
||||
for i = 1, #t do
|
||||
|
Reference in New Issue
Block a user