From b765f4cb219710bfa6bc56fcacec6932e292624f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 21 Sep 2024 12:53:03 -0700 Subject: [PATCH] why are these early returns in between app data --- src/runner/runner.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/runner/runner.rs b/src/runner/runner.rs index 8475486..62a7928 100644 --- a/src/runner/runner.rs +++ b/src/runner/runner.rs @@ -80,11 +80,10 @@ impl Runner{ Ok(runner) } pub fn run_script(&self,script:crate::script::Script,context:&mut Context)->Result<(),Error>{ - let yoink=script.name_source(context); + let (name,source)=script.name_source(context).map_err(Error::Script)?; + self.lua.globals().set("script",super::instance::Instance::from(script)).map_err(|error|Error::Lua{source:source.clone(),error})?; //this makes set_app_data shut up about the lifetime self.lua.set_app_data::<&'static mut rbx_dom_weak::WeakDom>(unsafe{core::mem::transmute(&mut context.dom)}); - let (name,source)=yoink.map_err(Error::Script)?; - self.lua.globals().set("script",super::instance::Instance::from(script)).map_err(|error|Error::Lua{source:source.clone(),error})?; let r=self.lua.load(source.as_str()) .set_name(name) .exec().map_err(|error|Error::Lua{source,error});