8.8.1.1.1.2.7. Expressions

interface Expressions()
evaluate(expression: string)

Evaluates a GEL expression and returns the resulting value, if numerical or a string. All standard rules for GEL expressions apply. If the result of evaluating the expression is an integral value, a BigInt will be returned. If the value is a floating point value, a standard Javascript number will be returned. For any other value, like a reference to a c++ object, we return without a value.

// Adds 8 to the address of the main symbol, returns a BigInt
let result = session.expressions.evaluate("main + 8");

// Returns a (floating point) number
let result = session.expressions.evaluate("1.0 / 2");

// Call a GEL function (assuming that this function is defined in a loaded GEL script)
session.expressions.evaluate('userDefinedGelFunction()');
Parameters:
  • expression (string) -- The GEL expression to evaluate.

Returns:

The value resulting from the evaluation of the expression, if numerical or a string.

Return type:

void | bigint | number | string