json.evaluate: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) (Initial write-up.) |
No edit summary |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=json.evaluate | |name=json.evaluate | ||
Line 5: | Line 4: | ||
|version=1.3b51 | |version=1.3b51 | ||
|description= | |description= | ||
Traverses a JSON array or JSON object and evaluates any macro code or rolls contained within. All macro code and rolls are evaluated against the current token. | Traverses a JSON array or JSON object and evaluates any macro code or rolls contained within. All macro code and rolls are evaluated against the current token. This function works like {{func|evalMacro}}. | ||
|usage= | |usage= | ||
Line 17: | Line 16: | ||
* {{code|array}} - The JSON array which has its contents evaluated. | * {{code|array}} - The JSON array which has its contents evaluated. | ||
* {{code|object}} - The JSON object which has its contents evaluated. | * {{code|object}} - The JSON object which has its contents evaluated. | ||
|example= | |||
This example doesn't really do anything. | |||
<source lang="mtmacro" line> | |||
[H: run = json.append("","[r: 1d6]")] | |||
[R: json.evaluate(run)]<br> | |||
[H: run = json.set("{}","roll","{3d6}")] | |||
[R: json.evaluate(run)] | |||
</source> | |||
'''Output:''' | |||
<source lang="mtmacro"> | |||
[5] | |||
{"roll":11} | |||
</source> | |||
|also= | |||
{{func|evalMacro}} | |||
}} | }} | ||
[[Category:JSON Function]] | [[Category:JSON Function]] |
Revision as of 12:32, 1 October 2019
json.evaluate() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.3b51
Traverses a JSON array or JSON object and evaluates any macro code or rolls contained within. All macro code and rolls are evaluated against the current token. This function works like evalMacro().
Usage
json.evaluate(array)
json.evaluate(object)
Parameters
array
- The JSON array which has its contents evaluated.object
- The JSON object which has its contents evaluated.
Example
This example doesn't really do anything.
[H: run = json.append("","[r: 1d6]")]
[R: json.evaluate(run)]<br>
[H: run = json.set("{}","roll","{3d6}")]
[R: json.evaluate(run)]
Output:
[5]
{"roll":11}