From c771e03ee235e6f5089134a03f62fca84fcf43fa Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 6 Sep 2017 18:13:05 -0300 Subject: -Fixed changes to default input actions not working, closes #10502 -Added Array.duplicate() method, needed to fix above --- core/array.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/array.cpp') diff --git a/core/array.cpp b/core/array.cpp index c35bf5bf0c..2e3fbf858d 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -210,6 +210,17 @@ const Variant &Array::get(int p_idx) const { return operator[](p_idx); } +Array Array::duplicate() const { + + Array new_arr; + int element_count = size(); + new_arr.resize(element_count); + for (int i = 0; i < element_count; i++) { + new_arr[i] = get(i); + } + + return new_arr; +} struct _ArrayVariantSort { _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const { -- cgit v1.2.3