diff --git a/src/vm/mod.rs b/src/vm/mod.rs index 73784c0..f90d97a 100644 --- a/src/vm/mod.rs +++ b/src/vm/mod.rs @@ -723,15 +723,12 @@ impl ClosureRunner { return Ok(None); } Instruction::Test(a, b, c) => { - let is_true = match self + let value = self .stack .get(b) .map(|v| v.borrow().clone()) - .unwrap_or(Value::Nil) - { - Value::Boolean(val) => (val.0 as u16) == *c, - _ => (false as u16) == *c, - }; + .unwrap_or(Value::Nil); + let is_true = (value.is_truthy() as u16) == *c; if is_true { let b = self.get_stack(*b); self.set_stack(*a, b);