Use tag for debugger state.
This commit is contained in:
@@ -56,17 +56,11 @@ fn test_debugger_state() -> Result<(), Box<EvalAltResult>> {
|
||||
Dynamic::from_map(state)
|
||||
},
|
||||
|mut context, _, _, _, _| {
|
||||
// Get global runtime state
|
||||
let global = context.global_runtime_state_mut();
|
||||
|
||||
// Get debugger
|
||||
let debugger = &mut global.debugger;
|
||||
|
||||
// Print debugger state - which is an object map
|
||||
println!("Current state = {}", debugger.state());
|
||||
println!("Current state = {}", context.tag());
|
||||
|
||||
// Modify state
|
||||
let mut state = debugger.state_mut().write_lock::<Map>().unwrap();
|
||||
let mut state = context.tag_mut().write_lock::<Map>().unwrap();
|
||||
let hello = state.get("hello").unwrap().as_int().unwrap();
|
||||
state.insert("hello".into(), (hello + 1).into());
|
||||
state.insert("foo".into(), true.into());
|
||||
|
Reference in New Issue
Block a user