From 71245995a4813d49449ac055f77cf60c896b483d Mon Sep 17 00:00:00 2001 From: Geequlim Date: Sat, 18 Jun 2016 15:07:51 +0800 Subject: Add @GDScript.type_exists --- modules/gdscript/gd_functions.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/gdscript/gd_functions.cpp') diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp index 90528614b3..ec66841662 100644 --- a/modules/gdscript/gd_functions.cpp +++ b/modules/gdscript/gd_functions.cpp @@ -87,6 +87,7 @@ const char *GDFunctions::get_func_name(Function p_func) { "funcref", "convert", "typeof", + "type_exists", "str", "print", "printt", @@ -531,6 +532,12 @@ void GDFunctions::call(Function p_func,const Variant **p_args,int p_arg_count,Va VALIDATE_ARG_COUNT(1); r_ret = p_args[0]->get_type(); + } break; + case TYPE_EXISTS: { + + VALIDATE_ARG_COUNT(1); + r_ret = ObjectTypeDB::type_exists(*p_args[0]); + } break; case TEXT_STR: { @@ -1126,6 +1133,7 @@ bool GDFunctions::is_deterministic(Function p_func) { case LOGIC_NEAREST_PO2: case TYPE_CONVERT: case TYPE_OF: + case TYPE_EXISTS: case TEXT_STR: case COLOR8: // enable for debug only, otherwise not desirable - case GEN_RANGE: @@ -1388,6 +1396,13 @@ MethodInfo GDFunctions::get_info(Function p_func) { mi.return_val.type=Variant::INT; return mi; + } break; + case TYPE_EXISTS: { + + MethodInfo mi("type_exists",PropertyInfo(Variant::STRING,"type")); + mi.return_val.type=Variant::BOOL; + return mi; + } break; case TEXT_STR: { -- cgit v1.2.3