diff options
Diffstat (limited to 'core/array.cpp')
-rw-r--r-- | core/array.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/array.cpp b/core/array.cpp index 30184a002e..171c11776c 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -233,9 +233,10 @@ struct _ArrayVariantSort { } }; -void Array::sort() { +Array &Array::sort() { _p->array.sort_custom<_ArrayVariantSort>(); + return *this; } struct _ArrayVariantSortCustom { @@ -253,19 +254,21 @@ struct _ArrayVariantSortCustom { return res; } }; -void Array::sort_custom(Object *p_obj, const StringName &p_function) { +Array &Array::sort_custom(Object *p_obj, const StringName &p_function) { - ERR_FAIL_NULL(p_obj); + ERR_FAIL_NULL_V(p_obj, *this); SortArray<Variant, _ArrayVariantSortCustom> avs; avs.compare.obj = p_obj; avs.compare.func = p_function; avs.sort(_p->array.ptr(), _p->array.size()); + return *this; } -void Array::invert() { +Array &Array::invert() { _p->array.invert(); + return *this; } void Array::push_front(const Variant &p_value) { |