diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-01-28 15:16:09 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-10 11:02:43 +0100 |
commit | 59bcc2888c0c6002428ed1040ef6b36957a80e98 (patch) | |
tree | e78cf547c47bb31e35827eff93f6e7c492399605 /core/variant/variant_callable.cpp | |
parent | 0ace0a129284ffc6646b199699c1607a316fcec0 (diff) | |
download | redot-engine-59bcc2888c0c6002428ed1040ef6b36957a80e98.tar.gz |
Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
Diffstat (limited to 'core/variant/variant_callable.cpp')
-rw-r--r-- | core/variant/variant_callable.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/variant/variant_callable.cpp b/core/variant/variant_callable.cpp index dc31b6d1ac..21f9a4f52b 100644 --- a/core/variant/variant_callable.cpp +++ b/core/variant/variant_callable.cpp @@ -68,6 +68,15 @@ ObjectID VariantCallable::get_object() const { return ObjectID(); } +int VariantCallable::get_argument_count(bool &r_is_valid) const { + if (!Variant::has_builtin_method(variant.get_type(), method)) { + r_is_valid = false; + return 0; + } + r_is_valid = true; + return Variant::get_builtin_method_argument_count(variant.get_type(), method); +} + void VariantCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const { Variant v = variant; v.callp(method, p_arguments, p_argcount, r_return_value, r_call_error); |