summaryrefslogtreecommitdiff
path: root/core/variant/callable.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant/callable.h')
-rw-r--r--core/variant/callable.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/variant/callable.h b/core/variant/callable.h
index 1f1c983eb3..32770bd663 100644
--- a/core/variant/callable.h
+++ b/core/variant/callable.h
@@ -71,6 +71,17 @@ public:
void callp(const Variant **p_arguments, int p_argcount, Variant &r_return_value, CallError &r_call_error) const;
void call_deferredp(const Variant **p_arguments, int p_argcount) const;
+ Variant callv(const Array &p_arguments) const;
+
+ template <typename... VarArgs>
+ void call_deferred(VarArgs... p_args) const {
+ Variant args[sizeof...(p_args) + 1] = { p_args..., 0 }; // +1 makes sure zero sized arrays are also supported.
+ const Variant *argptrs[sizeof...(p_args) + 1];
+ for (uint32_t i = 0; i < sizeof...(p_args); i++) {
+ argptrs[i] = &args[i];
+ }
+ return call_deferredp(sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args));
+ }
Error rpcp(int p_id, const Variant **p_arguments, int p_argcount, CallError &r_call_error) const;