turn run_scripts into member function

This commit is contained in:
Quaternions 2024-09-17 18:55:32 -07:00
parent 555b9773e6
commit aa361bce77

View File

@ -17,6 +17,16 @@ pub mod data{
} }
pub struct Dom(rbx_dom_weak::WeakDom); 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)] #[derive(Debug)]
pub enum ReadError{ pub enum ReadError{
@ -55,13 +65,3 @@ where
{ {
rbx::convert(&dom.0,acquire_render_config_id,acquire_mesh_id) 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())
}