summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDennis Brakhane <brakhane@gmail.com>2016-05-28 16:12:10 +0200
committerDennis Brakhane <brakhane@gmail.com>2016-06-05 20:00:54 +0200
commit1e068d34f4cb70c949aa7425c2b83169d745fd6b (patch)
tree43995d5dd86c40e82a16db10880bc963f9cf7934 /doc
parent842057e56f63c7dfc20b60615aa1a70fd5791d59 (diff)
Add support for Python-like negative indexing
Negative indexing is a useful feature in Python, especially when combined with array slicing. Array slicing will hopefully be implemented later, but negative indexing is useful in its own right. A negative index is indexing from the end of an array, "array[-1] == array[array.size()-1]", using a negative index larger/smaller than the length of the array is still an error. While primarily useful for arrays and strings, support is also added to "array like" structures like Vector3 and Color. This is done just to be consistent; vector3[2] is much clearer than vector3[-1], but disallowing it while allowing it for an array with 3 elements seems confusing.
Diffstat (limited to 'doc')
-rw-r--r--doc/base/classes.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 8f29c7f166..d71918b949 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -4325,7 +4325,7 @@
Generic array datatype.
</brief_description>
<description>
- Generic array, contains several elements of any type, accessible by numerical index starting at 0. Arrays are always passed by reference.
+ Generic array, contains several elements of any type, accessible by numerical index starting at 0. Negative indices can be used to count from the right, like in Python. Arrays are always passed by reference.
</description>
<methods>
<method name="append">