From a3a9b777adbc53df00cef4be5468282bfac099a3 Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 22 Jan 2022 20:52:09 +0100 Subject: [PATCH] Cart -> Int more cursed --- ablescript/src/variables.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 9b85c18..96d89d2 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(), } }