summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-04 11:38:34 +0800
committerEltrac <hi@guhub.cn>2025-03-04 11:38:34 +0800
commit1307ecc06232e606e57190b4e3dfef497bc7c185 (patch)
tree39f7103a6e8057cd5451404d00fbe07a44c23b7f /utils
parent435847f1ef23c13145a28d57dc018a5a0b777a9c (diff)
refactor: rewrite map generation
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.lua9
1 files changed, 9 insertions, 0 deletions
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