eval

fun eval(expr: String, action: String = "", verbose: Boolean = false): Any?

Evaluates a Java expr (optionally preceded by an action statement block) inside a generated Main.getValue() method, prepending any registered imports and variable declarations.

On the first call, registered variable bindings are placed into the engine context.

Return

the result of evaluating expr, or null if it evaluates to null

Parameters

expr

the Java expression whose value is returned

action

optional Java statements executed before expr is evaluated

verbose

if true, logs the generated script before evaluation