Skip to main content

eval

Function eval 

Source
pub fn eval<S, F>(expr: &Expr, storage: &S, fns: &F) -> Result<Value>
where S: VariableStorage, F: Fn(&str, Vec<Value>) -> Result<Value>,
Expand description

Evaluate an Expr AST node using storage for variable reads and fns for function calls.

fns receives the function name and evaluated arguments and must return a Value.

ยงErrors

Returns crate::error::DialogueError for undefined variables, type mismatches, or failed function calls.