diff --git a/src/lib.rs b/src/lib.rs index f49fb40..885c463 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,13 +18,17 @@ pub mod data{ pub struct Dom(rbx_dom_weak::WeakDom); impl Dom{ - pub fn run_scripts(&mut self){ - let mut context=roblox_emulator::context::Context::new(&mut self.0); + pub fn run_scripts(self)->Self{ + let runner=roblox_emulator::runner::Runner::new().unwrap(); + let mut context=roblox_emulator::context::Context::new(self.0); for script in context.scripts(){ - if let Err(e)=script.run(&mut context){ + let (modified_context,script_error)=runner.run_script(script,context); + context=modified_context; + if let Err(e)=script_error{ e.print(); } } + Self(context.into_inner()) } }