MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / all

Method all

core/variant/array.cpp:698–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696}
697
698bool Array::all(const Callable &p_callable) const {
699 const Variant *argptrs[1];
700 for (int i = 0; i < size(); i++) {
701 argptrs[0] = &get(i);
702
703 Variant result;
704 Callable::CallError ce;
705 p_callable.callp(argptrs, 1, result, ce);
706 if (ce.error != Callable::CallError::CALL_OK) {
707 ERR_FAIL_V_MSG(false, vformat("Error calling method from 'all': %s.", Variant::get_callable_error_text(p_callable, argptrs, 1, ce)));
708 }
709
710 if (!(result.operator bool())) {
711 // Return as early as possible when one of the inverted conditions is `false`.
712 // This improves performance compared to relying on `filter(...).size() >= array_size().`.
713 return false;
714 }
715 }
716
717 return true;
718}
719
720struct _ArrayVariantSort {
721 _FORCE_INLINE_ bool operator()(const Variant &p_l, const Variant &p_r) const {

Callers 2

SafeEngineFunction · 0.80

Calls 3

vformatFunction · 0.85
getFunction · 0.50
callpMethod · 0.45

Tested by

no test coverage detected