From cb7b087d5fdcbf7202abe09f353d133c314e754f Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Mon, 22 Mar 2021 15:54:37 +0100 Subject: [PATCH] feat(utils): add Table.contain --- sonic-radiance.love/core/utils/table.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sonic-radiance.love/core/utils/table.lua b/sonic-radiance.love/core/utils/table.lua index 46cd624..90064a6 100644 --- a/sonic-radiance.love/core/utils/table.lua +++ b/sonic-radiance.love/core/utils/table.lua @@ -24,6 +24,15 @@ 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) local acc for k, v in ipairs(list) do