Make non-existant globals return nil

This commit is contained in:
Sofia 2026-03-21 23:54:34 +02:00
parent 5246028c90
commit cc943915b2

View File

@ -558,9 +558,7 @@ impl<UserData: Clone> ClosureRunner<UserData> {
if let Some(global) = glob { if let Some(global) = glob {
self.set_stack(*reg, StackValue::Value(global)); self.set_stack(*reg, StackValue::Value(global));
} else { } else {
return Err(RuntimeError::GlobalNotFound( self.set_stack(*reg, StackValue::Value(Value::Nil));
constants.get(*global as usize).cloned(),
));
} }
} }
} }