feat(utils): add Table.contain
This commit is contained in:
parent
d57d5a7c0f
commit
cb7b087d5f
1 changed files with 9 additions and 0 deletions
|
@ -24,6 +24,15 @@
|
||||||
|
|
||||||
local Table = {}
|
local Table = {}
|
||||||
|
|
||||||
|
function Table.contain(table, content)
|
||||||
|
for k, v in ipairs(table) do
|
||||||
|
if (v == content) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
function Table.reduce(list, fn)
|
function Table.reduce(list, fn)
|
||||||
local acc
|
local acc
|
||||||
for k, v in ipairs(list) do
|
for k, v in ipairs(list) do
|
||||||
|
|
Loading…
Reference in a new issue