ExprContext

A Context stores the symbols used to evaluate an expression, such as the functions and variables currently visible to the expression. There is a global context in the ExprManager, and a local context can be passed to the eval method of the expression. The symbols in the global context are available to all expressions, and the symbols in the local context are just available to the expression being evaluated. Symbols in the local context override the symbols in the global context.

Constructor

new L3D.ExprContext()

Methods

callFunction()

Evaluate a function with the given name, using the given arguments. The number of arguments must be the same as the number required by the function.

getSymbol()

Find the symbol with the given name, either in this context or the parent context.

getVariableValue()

Get the value of a named variable.

import()

Import the map as symbols. A symbol can either be a variable or a function. Example: import({ "pi", Math.PI, "sin", [(ctx, args) => { return Math.sin(args[0]); }, 1] }); Where the map key is the symbol name of either a variable or a function, and the value is a double for a variable, or a list for a function. The function list consists of the function to call, and the required number of arguments. The function to call should take the follow parameters: (ExprContext context, List arguments).

setVariable()

Set the [value] of a named variable.