Closed stavinsky closed 4 years ago
Scope is currently defined like this:
pub type Scope = Vec<(String, Box<dyn Any>)>;
That means you can add to the scope by pushing into the vector:
let mut scope: Scope = Scope::new();
scope.push(("a".to_string(), Box::new(0i16)));
Sorry if this question already asked, but I can't understand how can I put for example string to the scope? I'm trying to make something like string parser that will get strings as input and parse them by user script in rhai. Thanks.
UPDATE: So it is finally works. As I understood I can write a function in user script and eval this script by the engine. After that the function will be available to be called by the call_fn with my params.