Fix globals being injected multiple times in repl

This commit is contained in:
Filip Tibell 2024-03-12 23:19:21 +01:00
parent 9f58414e99
commit 0116d405b2
No known key found for this signature in database

View file

@ -35,6 +35,8 @@ impl Runtime {
lua.set_app_data(Rc::downgrade(&lua)); lua.set_app_data(Rc::downgrade(&lua));
lua.set_app_data(Vec::<String>::new()); lua.set_app_data(Vec::<String>::new());
globals::inject_all(&lua).expect("Failed to inject globals");
Self { Self {
lua, lua,
args: Vec::new(), args: Vec::new(),
@ -65,7 +67,6 @@ impl Runtime {
) -> Result<ExitCode, RuntimeError> { ) -> Result<ExitCode, RuntimeError> {
// Create a new scheduler for this run // Create a new scheduler for this run
let sched = Scheduler::new(&self.lua); let sched = Scheduler::new(&self.lua);
globals::inject_all(&self.lua)?;
// Add error callback to format errors nicely + store status // Add error callback to format errors nicely + store status
let got_any_error = Arc::new(AtomicBool::new(false)); let got_any_error = Arc::new(AtomicBool::new(false));