json.evaluate

From RPTools Wiki
Revision as of 12:34, 1 October 2019 by Phergus (talk | contribs)
Jump to navigation Jump to search

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

Using json.eval on an array and an object.
[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}

See Also