Skip to content

Commit

Permalink
Formula engine: Lists can be indexed with negative numbers
Browse files Browse the repository at this point in the history
(this counts from the end)
  • Loading branch information
CelticMinstrel committed Mar 18, 2016
1 parent 38f6e8c commit 0b84677
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/variant.cpp
Expand Up @@ -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 {
Expand Down

0 comments on commit 0b84677

Please sign in to comment.