summaryrefslogtreecommitdiff
path: root/core/variant/callable.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-23 09:45:02 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-23 09:45:02 +0200
commitee95cc0b795ef4fa26de580b911f2ea18cae4167 (patch)
tree8b009c6753c6c182981f497f4ee640f3830bd8c0 /core/variant/callable.cpp
parent3a8e711e3383260110c8f6073eb5e240da963c2d (diff)
parent0c2055d15d000f9e7070d401ff9e03d4bb2b339e (diff)
Merge pull request #66177 from rburing/callable_callv
add `callv` method
Diffstat (limited to 'core/variant/callable.cpp')
-rw-r--r--core/variant/callable.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp
index 28efb43fc5..b35e2f004b 100644
--- a/core/variant/callable.cpp
+++ b/core/variant/callable.cpp
@@ -63,6 +63,21 @@ void Callable::callp(const Variant **p_arguments, int p_argcount, Variant &r_ret
}
}
+Variant Callable::callv(const Array &p_arguments) const {
+ int argcount = p_arguments.size();
+ const Variant **argptrs = nullptr;
+ if (argcount) {
+ argptrs = (const Variant **)alloca(sizeof(Variant *) * argcount);
+ for (int i = 0; i < argcount; i++) {
+ argptrs[i] = &p_arguments[i];
+ }
+ }
+ CallError ce;
+ Variant ret;
+ callp(argptrs, argcount, ret, ce);
+ return ret;
+}
+
Error Callable::rpcp(int p_id, const Variant **p_arguments, int p_argcount, CallError &r_call_error) const {
if (is_null()) {
r_call_error.error = CallError::CALL_ERROR_INSTANCE_IS_NULL;