summaryrefslogtreecommitdiff
path: root/doc/classes/Object.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Object.xml')
-rw-r--r--doc/classes/Object.xml45
1 files changed, 35 insertions, 10 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index f76038fd69..c9910360ed 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -4,17 +4,15 @@
Base class for all non built-in types.
</brief_description>
<description>
- Base class for all non built-in types. Everything which is not a built-in type starts the inheritance chain from this class.
- Objects can be constructed from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript.
- Objects do not manage memory, if inheriting from one the object will most likely have to be deleted manually (call the [method free] function from the script or delete from C++).
- Some derivatives add memory management, such as [Reference] (which keeps a reference count and deletes itself automatically when no longer referenced) and [Node], which deletes the children tree when deleted.
+ Every class which is not a built-in type inherits from this class.
+ You can construct Objects from scripting languages, using [code]Object.new()[/code] in GDScript, [code]new Object[/code] in C#, or the "Construct Object" node in VisualScript.
+ Objects do not manage memory. If a class inherits from Object, you will have to delete instances of it manually. To do so, call the [method free] method from your script or delete the instance from C++.
+ Some classes that extend Object add memory management. This is the case of [Reference], which counts references and deletes itself automatically when no longer referenced. [Node], another fundamental type, deletes all its children when freed from memory.
Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in [method _get_property_list] and handled in [method _get] and [method _set]. However, scripting languages and C++ have simpler means to export them.
- Objects also receive notifications ([method _notification]). Notifications are a simple way to notify the object about simple events, so they can all be handled together.
+ Objects also receive notifications. Notifications are a simple way to notify the object about simple events, so they can all be handled together. See [method _notification].
</description>
<tutorials>
</tutorials>
- <demos>
- </demos>
<methods>
<method name="_get" qualifiers="virtual">
<return type="Variant">
@@ -59,6 +57,14 @@
Sets a property. Returns [code]true[/code] if the [code]property[/code] exists.
</description>
</method>
+ <method name="_to_string" qualifiers="virtual">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override this method to customize the [String] representation of the object when it's being converted to a string, for example: [code]print(obj)[/code].
+ </description>
+ </method>
<method name="add_user_signal">
<return type="void">
</return>
@@ -120,7 +126,9 @@
<argument index="4" name="flags" type="int" default="0">
</argument>
<description>
- Connects a [code]signal[/code] to a [code]method[/code] on a [code]target[/code] object. Pass optional [code]binds[/code] to the call. Use [code]flags[/code] to set deferred or one shot connections. See [code]CONNECT_*[/code] constants. A [code]signal[/code] can only be connected once to a [code]method[/code]. It will throw an error if already connected. To avoid this, first use [method is_connected] to check for existing connections.
+ Connects a [code]signal[/code] to a [code]method[/code] on a [code]target[/code] object. Pass optional [code]binds[/code] to the call. Use [code]flags[/code] to set deferred or one shot connections. See [code]CONNECT_*[/code] constants.
+ A [code]signal[/code] can only be connected once to a [code]method[/code]. It will throw an error if already connected. To avoid this, first, use [method is_connected] to check for existing connections.
+ If the [code]target[/code] is destroyed in the game's lifecycle, the connection will be lost.
</description>
</method>
<method name="disconnect">
@@ -134,6 +142,7 @@
</argument>
<description>
Disconnects a [code]signal[/code] from a [code]method[/code] on the given [code]target[/code].
+ If you try to disconnect a connection that does not exist, the method will throw an error. Use [method is_connected] to ensure that the connection exists.
</description>
</method>
<method name="emit_signal" qualifiers="vararg">
@@ -329,6 +338,14 @@
<description>
</description>
</method>
+ <method name="remove_meta">
+ <return type="void">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set">
<return type="void">
</return>
@@ -346,7 +363,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- If set to true, signal emission is blocked.
+ If set to [code]true[/code], signal emission is blocked.
</description>
</method>
<method name="set_deferred">
@@ -375,7 +392,7 @@
<argument index="0" name="enable" type="bool">
</argument>
<description>
- Define whether the object can translate strings (with calls to [method tr]). Default is true.
+ Define whether the object can translate strings (with calls to [method tr]). Default is [code]true[/code].
</description>
</method>
<method name="set_meta">
@@ -398,6 +415,14 @@
Set a script into the object, scripts extend the object functionality.
</description>
</method>
+ <method name="to_string">
+ <return type="String">
+ </return>
+ <description>
+ Returns a [String] representing the object. Default is [code]"[ClassName:RID]"[/code].
+ Override the method [method _to_string] to customize the [String] representation.
+ </description>
+ </method>
<method name="tr" qualifiers="const">
<return type="String">
</return>