From 0b84677ee91af528cffc781e58e24b32412998a1 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 9 Mar 2016 22:35:32 -0500 Subject: [PATCH] Formula engine: Lists can be indexed with negative numbers (this counts from the end) --- src/variant.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variant.cpp b/src/variant.cpp index 03c2b934395c..ccbc76b262f7 100644 --- a/src/variant.cpp +++ b/src/variant.cpp @@ -450,6 +450,8 @@ variant variant::operator[](const variant& v) const slice.push_back( (*this)[v[i]] ); } return variant(&slice); + } else if(v.as_int() < 0) { + return operator[](num_elements() + v.as_int()); } return operator[](v.as_int()); } else {