Global

Methods

# evaluateExpression(expression, bindings, rvalopt) → {*}

Evaluates a JavaScript expression string with access to provided bindings.

Creates a sandboxed function that can access binding values by name, then executes it with those values. Used by templates for conditionals and dynamic expressions.

Parameters:
Name Type Attributes Default Description
expression string

The JavaScript expression to evaluate

bindings Object

Object mapping variable names to their values

rval boolean <optional>
true

If true, wraps expression in return statement

View Source rez_view.js, line 5

The result of evaluating the expression

*
Examples
// Evaluate a conditional
evaluateExpression("score > 10", { score: 15 }); // returns true
// Evaluate without return value (for side effects)
evaluateExpression("console.log(name)", { name: "Player" }, false);

# getObjectsWithAttr(attr_name) → {Array}

Return the ids of all game elements having the specified attribute.

Parameters:
Name Type Description
attr_name string

View Source rez_game.js, line 260

matching element ids

Array

# normalizeRefs(value) → {*}

Recursively normalizes reference objects in attribute values. The Rez compiler outputs element references as {$ref: "element_id"} objects. This function collapses them to plain ID strings for simpler runtime handling. Handles primitives, arrays, Sets, and plain objects. Special object types (RezDie, Map, etc.) pass through unchanged.

Parameters:
Name Type Description
value *

any value that may contain $ref objects

View Source rez_0_basic_object.js, line 5

the value with all {$ref: "id"} objects collapsed to plain "id" strings

*