Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/gdscript/doc_classes/@GDScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
- A constant from the [enum Variant.Type] enumeration, for example [constant TYPE_INT].
- An [Object]-derived class which exists in [ClassDB], for example [Node].
- A [Script] (you can use any class, including inner one).
Unlike the right operand of the [code]is[/code] operator, [param type] can be a non-constant value. The [code]is[/code] operator supports more features (such as typed arrays). Use the operator instead of this method if you do not need to check the type dynamically.
Unlike the right operand of the [code]is[/code] operator, [param type] can be a non-constant value. The [code]is[/code] operator supports more features (such as typed arrays and dictionaries). Use the operator instead of this method if you do not need to check the type dynamically.
[b]Examples:[/b]
[codeblock]
print(is_instance_of(a, TYPE_INT))
Expand All @@ -142,7 +142,7 @@
print(is_instance_of(a, MyClass.InnerClass))
[/codeblock]
[b]Note:[/b] If [param value] and/or [param type] are freed objects (see [method @GlobalScope.is_instance_valid]), or [param type] is not one of the above options, this method will raise a runtime error.
See also [method @GlobalScope.typeof], [method type_exists], [method Array.is_same_typed] (and other [Array] methods).
See also [method @GlobalScope.typeof], [method Object.is_class], [method Object.get_script], [method Array.is_same_typed] (and other [Array] methods), [method Dictionary.is_same_typed] (and other [Dictionary] methods).
</description>
</method>
<method name="len">
Expand Down Expand Up @@ -266,7 +266,7 @@
[/codeblock]
</description>
</method>
<method name="type_exists">
<method name="type_exists" deprecated="Use [method ClassDB.class_exists] instead.">
<return type="bool" />
<param index="0" name="type" type="StringName" />
<description>
Expand Down
4 changes: 2 additions & 2 deletions modules/gdscript/gdscript_utility_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ struct GDScriptUtilityFunctionsDefinitions {

Variant::construct(Variant::Type(type), *r_ret, p_args, 1, r_error);
}
#endif // DISABLE_DEPRECATED

static inline void type_exists(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
DEBUG_VALIDATE_ARG_COUNT(1, 1);
DEBUG_VALIDATE_ARG_TYPE(0, Variant::STRING_NAME);
*r_ret = ClassDB::class_exists(*p_args[0]);
}
#endif // DISABLE_DEPRECATED

static inline void _char(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
DEBUG_VALIDATE_ARG_COUNT(1, 1);
Expand Down Expand Up @@ -571,8 +571,8 @@ void GDScriptUtilityFunctions::register_functions() {
/* clang-format off */
#ifndef DISABLE_DEPRECATED
REGISTER_FUNC( convert, true, RETVAR, ARGS( ARGVAR("what"), ARGTYPE("type") ), false, varray( ));
#endif // DISABLE_DEPRECATED
REGISTER_FUNC( type_exists, true, RET(BOOL), ARGS( ARG("type", STRING_NAME) ), false, varray( ));
#endif // DISABLE_DEPRECATED
REGISTER_FUNC( _char, true, RET(STRING), ARGS( ARG("code", INT) ), false, varray( ));
REGISTER_FUNC( ord, true, RET(INT), ARGS( ARG("char", STRING) ), false, varray( ));
REGISTER_FUNC( range, false, RET(ARRAY), NOARGS, true, varray( ));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ func test():
print(var_to_str(COLOR))
print(var_to_str(color))

var string := "Node"
var string_name := &"Node"
print(type_exists(string))
print(type_exists(string_name))
var string := "A"
var string_name := &"A"
print(ord(string))
print(ord(string_name))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GDTEST_OK
Color(1, 0, 0, 1)
Color(1, 0, 0, 1)
true
true
65
65
Loading