Skip to content

Commit

Permalink
Add documentation note on Object's boolean context
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Nov 28, 2024
1 parent 711c725 commit 2ad161a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions doc/classes/Object.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
Lastly, every object can also contain metadata (data about data). [method set_meta] can be useful to store information that the object itself does not depend on. To keep your code clean, making excessive use of metadata is discouraged.
[b]Note:[/b] Unlike references to a [RefCounted], references to an object stored in a variable can become invalid without being set to [code]null[/code]. To check if an object has been deleted, do [i]not[/i] compare it against [code]null[/code]. Instead, use [method @GlobalScope.is_instance_valid]. It's also recommended to inherit from [RefCounted] for classes storing data instead of [Object].
[b]Note:[/b] The [code]script[/code] is not exposed like most properties. To set or get an object's [Script] in code, use [method set_script] and [method get_script], respectively.
[b]Note:[/b] In a boolean context, an [Object] will evaluate to [code]false[/code] if it is equal to [code]null[/code]. Otherwise, an [Object] will always evaluate to [code]true[/code], even if it has been freed. This behavior may change in future releases. See also [method @GlobalScope.is_instance_valid].
</description>
<tutorials>
<link title="Object class introduction">$DOCS_URL/contributing/development/core_and_modules/object_class.html</link>
Expand Down

0 comments on commit 2ad161a

Please sign in to comment.