From aa361bce775828840955a130db0a2127f20c1e0d Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 17 Sep 2024 18:55:32 -0700 Subject: [PATCH] turn run_scripts into member function --- src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b57b51b..f49fb40 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,16 @@ 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); + for script in context.scripts(){ + if let Err(e)=script.run(&mut context){ + e.print(); + } + } + } +} #[derive(Debug)] pub enum ReadError{ @@ -55,13 +65,3 @@ where { rbx::convert(&dom.0,acquire_render_config_id,acquire_mesh_id) } - -pub fn run_scripts(dom:Dom)->Dom{ - let mut context=roblox_emulator::context::Context::new(dom.0); - for script in context.scripts(){ - if let Err(e)=script.run(&mut context){ - e.print(); - } - } - Dom(context.into_inner()) -}