summaryrefslogtreecommitdiffstats
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-11-07 16:34:54 -0300
committerGitHub <noreply@github.com>2020-11-07 16:34:54 -0300
commit30b6db99a99a94c64d906c1b828ff44f79a1bc75 (patch)
tree0c33e76f2effa5dcb48a7443ae888c20cbda1e44 /core/variant_op.cpp
parent709964849fdc0c2cb34e5e851df71a66ee28ba1e (diff)
parent05de7ce6caf441f8b64dd60d1837835f10d06520 (diff)
downloadredot-engine-30b6db99a99a94c64d906c1b828ff44f79a1bc75.tar.gz
Merge pull request #43371 from reduz/variant-setget-refactor
Refactored Variant setters/getters
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 5e851323c4..82722ea088 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1481,7 +1481,6 @@ void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p
}
void register_variant_operators() {
- printf("size of OT %i\n", (int)sizeof(operator_evaluator_table));
zeromem(operator_return_type_table, sizeof(operator_return_type_table));
zeromem(operator_evaluator_table, sizeof(operator_evaluator_table));
zeromem(validated_operator_evaluator_table, sizeof(validated_operator_evaluator_table));
@@ -2122,3 +2121,15 @@ Variant::operator bool() const {
bool Variant::booleanize() const {
return !is_zero();
}
+
+bool Variant::in(const Variant &p_index, bool *r_valid) const {
+ bool valid;
+ Variant ret;
+ evaluate(OP_IN, p_index, *this, ret, valid);
+ if (r_valid) {
+ *r_valid = valid;
+ return false;
+ }
+ ERR_FAIL_COND_V(ret.type != BOOL, false);
+ return *VariantGetInternalPtr<bool>::get_ptr(&ret);
+}