make it possible to execute an lua file and code block in the same module

This commit is contained in:
Adrian Malacoda 2018-02-25 22:49:18 -06:00
parent fec6f7f274
commit 44b6eecd70

View File

@ -125,14 +125,12 @@ impl EventLoop for LuaModule {
sender: Box::new(sender.clone()) sender: Box::new(sender.clone())
}); });
match self.code { if let Some(ref file) = self.file {
Some(ref code) => { lua.execute(&code).unwrap() }, lua.execute_from_reader::<(), _>(File::open(&Path::new(file)).unwrap()).unwrap();
None => {
match self.file {
Some(ref file) => { lua.execute_from_reader::<(), _>(File::open(&Path::new(file)).unwrap()).unwrap(); }
None => {}
}
} }
if let Some(ref code) = self.code {
lua.execute(&code).unwrap()
} }
loop { loop {