diff options
| author | Kazuo256 | 2016-11-18 18:30:16 -0200 |
|---|---|---|
| committer | Kazuo256 | 2016-11-18 18:45:51 -0200 |
| commit | bf4fda64fd403d589278919cff01c3207164207e (patch) | |
| tree | bed9a1d2244b31ec27a40fa18cda6c6357608379 /core/array.cpp | |
| parent | 959683c3d8f7aaa7469d5758c7698e0da108b406 (diff) | |
| download | godot-bf4fda64fd403d589278919cff01c3207164207e.tar.gz godot-bf4fda64fd403d589278919cff01c3207164207e.tar.zst godot-bf4fda64fd403d589278919cff01c3207164207e.zip | |
Diffstat (limited to 'core/array.cpp')
| -rw-r--r-- | core/array.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/array.cpp b/core/array.cpp index 683a43e3d..f7ca67b6a 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -150,6 +150,16 @@ void Array::erase(const Variant& p_value) { _p->array.erase(p_value); } +Variant Array::front() const { + ERR_FAIL_COND_V(_p->array.size() == 0, Variant()); + return operator[](0); +} + +Variant Array::back() const { + ERR_FAIL_COND_V(_p->array.size() == 0, Variant()); + return operator[](_p->array.size() - 1); +} + int Array::find(const Variant& p_value, int p_from) const { return _p->array.find(p_value, p_from); |
