This commit is contained in:
Sofia 2026-03-21 15:27:29 +02:00
parent c37682aa19
commit 76fa290988

View File

@ -1042,26 +1042,27 @@ impl ClosureRunner {
Instruction::Equal(res, lhs, rhs) => {
let (lhs, rhs) = self.lhs_and_rhs(lhs, rhs);
match (&lhs, &rhs) {
(Value::Table { metatable, .. }, Value::Table { .. }) => {
self.set_stack(
*res,
StackValue::Value(Value::Boolean(LuaBool(
self.call_metamethod(
let metatable = match (&lhs, &rhs) {
(Value::Table { metatable, .. }, _) => Some(metatable),
(_, Value::Table { metatable, .. }) => Some(metatable),
_ => todo!(),
};
let value = if let Some(metatable) = metatable {
match self.call_metamethod(
metatable,
"__eq",
vec![lhs.clone(), rhs.clone()],
)??
.first()
.unwrap()
.is_truthy(),
))),
);
}
_ => {
self.set_stack(*res, StackValue::Value(lhs.eq(&rhs)?));
}
) {
Ok(value) => StackValue::Value(extract_ret_value(value)?),
Err(_) => StackValue::Value(lhs.eq(&rhs)?),
}
} else {
StackValue::Value(lhs.eq(&rhs)?)
};
self.set_stack(*res, value);
}
Instruction::LessThan(res, lhs, rhs) => {
let (lhs, rhs) = self.lhs_and_rhs(lhs, rhs);