summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/util.lua
diff options
context:
space:
mode:
authorNicky Dasmijn <nicky.dasmijn@posteo.nl>2024-04-03 21:36:43 +0200
committerGitHub <noreply@github.com>2024-04-03 21:36:43 +0200
commit6b8f86885b500555ec4f2bb06db8fc9020b723cd (patch)
tree41a91394ea2d30164fb674ffe3e10c6f26250a6c /indra/newview/scripts/lua/util.lua
parentc8f7e9d0256cec90d509b0cf0109c2c7479100d0 (diff)
parentf069543328efc441673db9877c97ae2201b86e91 (diff)
Merge branch 'release/luau-scripting' into release/luau-scripting
Diffstat (limited to 'indra/newview/scripts/lua/util.lua')
-rw-r--r--indra/newview/scripts/lua/util.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/indra/newview/scripts/lua/util.lua b/indra/newview/scripts/lua/util.lua
index e3af633ea7..a2191288f6 100644
--- a/indra/newview/scripts/lua/util.lua
+++ b/indra/newview/scripts/lua/util.lua
@@ -2,9 +2,9 @@
local util = {}
--- cheap test whether table t is empty
-function util.empty(t)
- return not next(t)
+-- check if array-like table contains certain value
+function util.contains(t, v)
+ return table.find(t, v) ~= nil
end
-- reliable count of the number of entries in table t
@@ -17,6 +17,11 @@ function util.count(t)
return count
end
+-- cheap test whether table t is empty
+function util.empty(t)
+ return not next(t)
+end
+
-- recursive table equality
function util.equal(t1, t2)
if not (type(t1) == 'table' and type(t2) == 'table') then