forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintersect.lcdoc
More file actions
44 lines (27 loc) · 1.8 KB
/
intersect.lcdoc
File metadata and controls
44 lines (27 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Name: intersect
Type: command
Syntax: intersect <array> with <templateArray> [<recursively>]
Summary: Removes <element(glossary)|elements> from an <array> if they have no corresponding <element(keyword)> in another <array>.
Introduced: 1.1
OS: mac,windows,linux,ios,android
Platforms: desktop,server,web,mobile
Example:
put "green" into tArray1["color"]
put "left" into tArray1["align"]
put "blue" into tArray2["color"]
put "100" into tArray2["width"]
intersct tArray1 with tArray2
# RESULT
# tArray1[“colour”] = “green”
# tArray2[“colour”] = “blue”
# tArray2[“width”] = “100”
Parameters:
array (array):
templateArray (array):
recursively: The recursively adverb indicates that the intersect should recurse through nested arrays.
Description:
Use the <intersect> <command> to filter out <element(glossary)|elements> from an <array> according to the contents of another <array>.
Each key of the <array> is checked to see whether there is a matching <key> in the <templateArray>. The <element(glossary)|elements> of <array> that do not match an <element(keyword)> of the <templateArray> are removed from the <array>.
The content of individual elements of the <templateArray> does not affect the final result. Only which <element(glossary)|elements> exist in the <templateArray>, not their content, controls which <element(glossary)|elements> of the <array> are retained and which are removed. If the <array> and <templateArray> have the same set of <element(glossary)|elements> but different content in each <element(keyword)>, the <intersect> <command> does not change the value of the <array>.
References: split (command), union (command), element (keyword), element (glossary), array (glossary), command (glossary), key (glossary)
Tags: properties