diff options
author | Nicky Dasmijn <nicky.dasmijn@posteo.nl> | 2024-04-03 21:36:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 21:36:43 +0200 |
commit | 6b8f86885b500555ec4f2bb06db8fc9020b723cd (patch) | |
tree | 41a91394ea2d30164fb674ffe3e10c6f26250a6c /indra/newview/scripts/lua/util.lua | |
parent | c8f7e9d0256cec90d509b0cf0109c2c7479100d0 (diff) | |
parent | f069543328efc441673db9877c97ae2201b86e91 (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.lua | 11 |
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 |