From baea9e297c4cb75cb31529d434fb8b6c58b336b3 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 18 Sep 2024 18:48:39 -0700 Subject: [PATCH] sad api --- src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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()) } }