diff options
author | Bastiaan Olij <mux213@gmail.com> | 2021-11-18 14:05:14 +1100 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2021-11-23 19:44:53 +1100 |
commit | b008810c0121e0a365a41615c48b40934aae9a29 (patch) | |
tree | 4784c992ba7e0dd538e1959293b5f239576810b9 /test/src | |
parent | 5cacce7a26b6b31600c063344f1fb52aef2382ef (diff) | |
download | redot-cpp-b008810c0121e0a365a41615c48b40934aae9a29.tar.gz |
Implementing dictionary operators
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/example.cpp | 11 | ||||
-rw-r--r-- | test/src/example.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp index e2a6ceb..ad82103 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -54,7 +54,9 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("return_something_const"), &Example::return_something_const); ClassDB::bind_method(D_METHOD("return_extended_ref"), &Example::return_extended_ref); ClassDB::bind_method(D_METHOD("extended_ref_checks"), &Example::extended_ref_checks); + ClassDB::bind_method(D_METHOD("test_array"), &Example::test_array); + ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); { MethodInfo mi; @@ -145,6 +147,15 @@ Array Example::test_array() const { return arr; } +Dictionary Example::test_dictionary() const { + Dictionary dict; + + dict["hello"] = "world"; + dict["foo"] = "bar"; + + return dict; +} + // Properties. void Example::set_custom_position(const Vector2 &pos) { custom_position = pos; diff --git a/test/src/example.h b/test/src/example.h index 79bcdd9..214b076 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -88,7 +88,9 @@ public: Ref<ExampleRef> extended_ref_checks(Ref<ExampleRef> p_ref) const; Variant varargs_func(const Variant **args, GDNativeInt arg_count, GDNativeCallError &error); void emit_custom_signal(const String &name, int value); + Array test_array() const; + Dictionary test_dictionary() const; // Property. void set_custom_position(const Vector2 &pos); |