GDScript: Deprecate type_exists() global function

This commit is contained in:
Danil Alexeev
2026-02-28 21:53:02 +03:00
parent a596178702
commit 65a7cab928
4 changed files with 11 additions and 11 deletions
+3 -3
View File
@@ -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))
@@ -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">
@@ -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>