summaryrefslogtreecommitdiffstats
path: root/core/object
diff options
context:
space:
mode:
authorrune-scape <allie.smith.epic@gmail.com>2023-12-28 14:44:23 -0800
committerrune-scape <spartacrafter@gmail.com>2024-08-29 13:39:27 -0700
commit154049ce1792a6e12b990e0a414a6c084c3b91c5 (patch)
tree102bda57c74f9efaa227c970255327f734043ce9 /core/object
parent40b378e9e2338d84f897f6991cc913a713295785 (diff)
downloadredot-engine-154049ce1792a6e12b990e0a414a6c084c3b91c5.tar.gz
StringName Dictionary keys
also added 'is_string()' method to Variant and refactored many String type comparisons to use it instead
Diffstat (limited to 'core/object')
-rw-r--r--core/object/object.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp
index a2330ecd04..1e06dc8e35 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -605,7 +605,7 @@ Variant Object::_call_bind(const Variant **p_args, int p_argcount, Callable::Cal
return Variant();
}
- if (p_args[0]->get_type() != Variant::STRING_NAME && p_args[0]->get_type() != Variant::STRING) {
+ if (!p_args[0]->is_string()) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING_NAME;
@@ -624,7 +624,7 @@ Variant Object::_call_deferred_bind(const Variant **p_args, int p_argcount, Call
return Variant();
}
- if (p_args[0]->get_type() != Variant::STRING_NAME && p_args[0]->get_type() != Variant::STRING) {
+ if (!p_args[0]->is_string()) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING_NAME;
@@ -720,7 +720,7 @@ Variant Object::getvar(const Variant &p_key, bool *r_valid) const {
*r_valid = false;
}
- if (p_key.get_type() == Variant::STRING_NAME || p_key.get_type() == Variant::STRING) {
+ if (p_key.is_string()) {
return get(p_key, r_valid);
}
return Variant();
@@ -730,7 +730,7 @@ void Object::setvar(const Variant &p_key, const Variant &p_value, bool *r_valid)
if (r_valid) {
*r_valid = false;
}
- if (p_key.get_type() == Variant::STRING_NAME || p_key.get_type() == Variant::STRING) {
+ if (p_key.is_string()) {
return set(p_key, p_value, r_valid);
}
}
@@ -1096,7 +1096,7 @@ Error Object::_emit_signal(const Variant **p_args, int p_argcount, Callable::Cal
ERR_FAIL_V(Error::ERR_INVALID_PARAMETER);
}
- if (unlikely(p_args[0]->get_type() != Variant::STRING_NAME && p_args[0]->get_type() != Variant::STRING)) {
+ if (unlikely(!p_args[0]->is_string())) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 0;
r_error.expected = Variant::STRING_NAME;