Type Definition rhai::Scope [] [src]

type Scope = Vec<(String, Box<Any>)>;

A type containing information about current scope. Useful for keeping state between Engine runs

use rhai::{Engine, Scope};

let mut engine = Engine::new();
let mut my_scope = Scope::new();

assert!(engine.eval_with_scope::<()>(&mut my_scope, "let x = 5;").is_ok());
assert_eq!(engine.eval_with_scope::<i64>(&mut my_scope, "x + 1").unwrap(), 6);

Between runs, Engine only remembers functions when not using own Scope.