summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-07-27 16:54:06 +0200
committerGitHub <noreply@github.com>2018-07-27 16:54:06 +0200
commit6afabc03350f468b253524d600c978ae3aa66e07 (patch)
treedfc9c1d674ef2ab47c18276062e38cc19bbd3cf8 /modules
parenteb17a65dec77ed36aa20887fd3ea8b89bdb3c767 (diff)
parent8a914f17b0646c98b115e06e382b864f7a47a335 (diff)
Merge pull request #20516 from BastiaanOlij/fix_nativescript_getset
Fixed nativescript getter and setter logic
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 3a49b3fe71..23747af86b 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -556,12 +556,17 @@ bool NativeScriptInstance::set(const StringName &p_name, const Variant &p_value)
Variant name = p_name;
const Variant *args[2] = { &name, &p_value };
- E->get().method.method((godot_object *)owner,
+ godot_variant result;
+ result = E->get().method.method((godot_object *)owner,
E->get().method.method_data,
userdata,
2,
(godot_variant **)args);
- return true;
+ bool handled = *(Variant *)&result;
+ godot_variant_destroy(&result);
+ if (handled) {
+ return true;
+ }
}
script_data = script_data->base_data;
@@ -596,10 +601,9 @@ bool NativeScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
(godot_variant **)args);
r_ret = *(Variant *)&result;
godot_variant_destroy(&result);
- if (r_ret.get_type() == Variant::NIL) {
- return false;
+ if (r_ret.get_type() != Variant::NIL) {
+ return true;
}
- return true;
}
script_data = script_data->base_data;