mirror of
https://github.com/kepler155c/opus
synced 2024-06-18 11:20:01 +00:00
23 lines
290 B
Lua
23 lines
290 B
Lua
local Array = { }
|
|
|
|
function Array.filter(it, f)
|
|
local ot = { }
|
|
for _,v in pairs(it) do
|
|
if f(v) then
|
|
table.insert(ot, v)
|
|
end
|
|
end
|
|
return ot
|
|
end
|
|
|
|
function Array.removeByValue(t, e)
|
|
for k,v in pairs(t) do
|
|
if v == e then
|
|
table.remove(t, k)
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
return Array
|