summaryrefslogtreecommitdiffstats
path: root/core/array.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-01-02 19:12:25 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-01-02 19:12:25 -0300
commitce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch)
tree5f9c387037d0142d40f7275575436483dc0a7237 /core/array.cpp
parentab4126f51061277e87b41c48b40e7b54942d4eca (diff)
parent45c5c89de961357a7042d9e1f063e288d7a510cf (diff)
downloadredot-engine-ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae.tar.gz
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'core/array.cpp')
-rw-r--r--core/array.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/array.cpp b/core/array.cpp
index 683a43e3d0..50cc9eee47 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -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);