File tree 1 file changed +20
-6
lines changed
1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,29 @@ local function Clone(t)
20
20
return target
21
21
end
22
22
23
- --- supv.table.contains - Check if a table contains a value
23
+ --- supv.table.contains - Check if a table contains a value(s)
24
24
--- @param t table
25
25
--- @param value any
26
26
--- @return boolean
27
- local function Contains (t , value )
28
- for _ , v in pairs (t )do
29
- if v == value then return true end
30
- end
31
- return false
27
+ local function Contains (tbl , value )
28
+ if type (value ) ~= ' table' then
29
+ for _ , v in pairs (tbl ) do
30
+ if v == value then return true end
31
+ end
32
+ else
33
+ local matched_values = 0
34
+ local values = 0
35
+ for _ , v1 in pairs (value ) do
36
+ values += 1
37
+
38
+ for _ , v2 in pairs (tbl ) do
39
+ if v1 == v2 then matched_values += 1 end
40
+ end
41
+ end
42
+ if matched_values == values then return true end
43
+ end
44
+
45
+ return false
32
46
end
33
47
34
48
local function toVec3 (coords )
You can’t perform that action at this time.
0 commit comments