json.intersection: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Bone White (talk | contribs) (Added a further explaination for what an intersection is, and added an example.) |
||
Line 4: | Line 4: | ||
|version=1.3b53 | |version=1.3b53 | ||
|description= | |description= | ||
Returns a [[JSON Array]] with the intersection of all of the [[JSON Object]] keys or [[JSON Array]] values. | Returns a [[JSON Array]] with the intersection of all of the [[JSON Object]] keys or [[JSON Array]] values. An value or key only appears in the output if it exists in all input arrays or objects. | ||
|usage= | |usage= | ||
Line 16: | Line 16: | ||
{{param|array|A [[JSON Array]] used in the intersection.}} | {{param|array|A [[JSON Array]] used in the intersection.}} | ||
{{param|object|A [[JSON Object]] used in the intersection.}} | {{param|object|A [[JSON Object]] used in the intersection.}} | ||
|examples= | |||
<source lang="mtmacro" line> | |||
[h: array1 = json.append("",1,2,3,4)] <br> | |||
[h: array2 = json.append("",3,4,5,6)] <br> | |||
[r: json.intersection(array1,array2) | |||
</source> | |||
Returns | |||
"[3,4]" | |||
|also= | |also= |
Revision as of 07:49, 10 July 2013
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
This article needs: Examples of usage, and clearer description.
json.intersection() Function
• Introduced in version 1.3b53
Returns a JSON Array with the intersection of all of the JSON Object keys or JSON Array values. An value or key only appears in the output if it exists in all input arrays or objects.
Usage
json.intersection(array, array, ...)
json.intersection(object, object, ...)
Parameters
array
- A JSON Array used in the intersection.object
- A JSON Object used in the intersection.
Examples
[h: array1 = json.append("",1,2,3,4)] <br>
[h: array2 = json.append("",3,4,5,6)] <br>
[r: json.intersection(array1,array2)
Returns
"[3,4]"