Merge pull request #64076 from raulsntos/doc-fixes

Add `@GDScript.type_exists` documentation, Fix typo in weakref documentation
This commit is contained in:
Rémi Verschelde 2022-08-08 19:15:25 +02:00 committed by GitHub
commit 862dedcefe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1125,7 +1125,7 @@
<return type="Variant" /> <return type="Variant" />
<argument index="0" name="obj" type="Variant" /> <argument index="0" name="obj" type="Variant" />
<description> <description>
Returns a weak reference to an object, or [code]null[/code] is the argument is invalid. Returns a weak reference to an object, or [code]null[/code] if the argument is invalid.
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it.
</description> </description>
</method> </method>

View File

@ -239,6 +239,11 @@
<return type="bool" /> <return type="bool" />
<argument index="0" name="type" type="StringName" /> <argument index="0" name="type" type="StringName" />
<description> <description>
Returns whether the given [Object]-derived class exists in [ClassDB]. Note that [Variant] data types are not registered in [ClassDB].
[codeblock]
type_exists("Sprite2D") # Returns true
type_exists("NonExistentClass") # Returns false
[/codeblock]
</description> </description>
</method> </method>
</methods> </methods>