summaryrefslogtreecommitdiff
path: root/core/os/main_loop.cpp
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 /core/os/main_loop.cpp
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 'core/os/main_loop.cpp')
0 files changed, 0 insertions, 0 deletions