summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/variant/variant.h1
-rw-r--r--core/variant/variant_utility.cpp22
2 files changed, 23 insertions, 0 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 9ec131a1b8..d3f694e7ca 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -641,6 +641,7 @@ public:
static UtilityFunctionType get_utility_function_type(const StringName &p_name);
+ static MethodInfo get_utility_function_info(const StringName &p_name);
static int get_utility_function_argument_count(const StringName &p_name);
static Variant::Type get_utility_function_argument_type(const StringName &p_name, int p_arg);
static String get_utility_function_argument_name(const StringName &p_name, int p_arg);
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 55c1376031..666b582e39 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -1333,6 +1333,28 @@ Variant::UtilityFunctionType Variant::get_utility_function_type(const StringName
return bfi->type;
}
+MethodInfo Variant::get_utility_function_info(const StringName &p_name) {
+ MethodInfo info;
+ const VariantUtilityFunctionInfo *bfi = utility_function_table.lookup_ptr(p_name);
+ if (bfi) {
+ info.name = p_name;
+ if (bfi->returns_value && bfi->return_type == Variant::NIL) {
+ info.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT;
+ }
+ info.return_val.type = bfi->return_type;
+ if (bfi->is_vararg) {
+ info.flags |= METHOD_FLAG_VARARG;
+ }
+ for (int i = 0; i < bfi->argnames.size(); ++i) {
+ PropertyInfo arg;
+ arg.type = bfi->get_arg_type(i);
+ arg.name = bfi->argnames[i];
+ info.arguments.push_back(arg);
+ }
+ }
+ return info;
+}
+
int Variant::get_utility_function_argument_count(const StringName &p_name) {
const VariantUtilityFunctionInfo *bfi = utility_function_table.lookup_ptr(p_name);
if (!bfi) {