From 1307ecc06232e606e57190b4e3dfef497bc7c185 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Tue, 4 Mar 2025 11:38:34 +0800 Subject: refactor: rewrite map generation --- utils/utils.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'utils') diff --git a/utils/utils.lua b/utils/utils.lua index af560c6..e68d00c 100644 --- a/utils/utils.lua +++ b/utils/utils.lua @@ -84,3 +84,12 @@ end function utils.any(tbl) return tbl[math.random(#tbl)] end + +function utils.indexof(tbl, value) + for i, v in ipairs(tbl) do + if v == value then + return i + end + end + return nil +end -- cgit v1.2.3