diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 9b85c184..96d89d20 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -122,10 +122,14 @@ impl Value { match self { Value::Abool(a) => a as _, Value::Bool(b) => b as _, + Value::Functio(_) => self.len(), Value::Int(i) => i, Value::Nul => consts::ANSWER, Value::Str(text) => text.parse().unwrap_or(consts::ANSWER), - _ => self.len() as _, + Value::Cart(c) => c + .into_iter() + .map(|(i, v)| i.into_i32() * v.borrow().clone().into_i32()) + .sum(), } }