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()) -}