diff --git a/src/modules/lua.rs b/src/modules/lua.rs index 9766128..03eea2e 100644 --- a/src/modules/lua.rs +++ b/src/modules/lua.rs @@ -125,14 +125,12 @@ impl EventLoop for LuaModule { sender: Box::new(sender.clone()) }); - match self.code { - Some(ref code) => { lua.execute(&code).unwrap() }, - None => { - match self.file { - Some(ref file) => { lua.execute_from_reader::<(), _>(File::open(&Path::new(file)).unwrap()).unwrap(); } - None => {} - } - } + if let Some(ref file) = self.file { + lua.execute_from_reader::<(), _>(File::open(&Path::new(file)).unwrap()).unwrap(); + } + + if let Some(ref code) = self.code { + lua.execute(&code).unwrap() } loop {