diff options
Diffstat (limited to 'doc/classes/Object.xml')
-rw-r--r-- | doc/classes/Object.xml | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 5a09fe39c0..858bf5b635 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="Object" category="Core" version="3.2"> +<class name="Object" version="4.0"> <brief_description> Base class for all non built-in types. </brief_description> @@ -9,6 +9,12 @@ 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. + Property membership can be tested directly in GDScript using [code]in[/code]: + [codeblock] + var n = Node2D.new() + print("position" in n) # Prints "True". + print("other_property" in n) # Prints "False". + [/codeblock] Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See [method _notification]. </description> <tutorials> @@ -93,12 +99,12 @@ </description> </method> <method name="call_deferred" qualifiers="vararg"> - <return type="Variant"> + <return type="void"> </return> <argument index="0" name="method" type="String"> </argument> <description> - Calls the [code]method[/code] on the object during idle time and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example: + Calls the [code]method[/code] on the object during idle time. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example: [codeblock] call_deferred("set", "position", Vector2(42.0, 0.0)) [/codeblock] @@ -172,7 +178,7 @@ </description> </method> <method name="emit_signal" qualifiers="vararg"> - <return type="Variant"> + <return type="void"> </return> <argument index="0" name="signal" type="String"> </argument> @@ -197,7 +203,7 @@ <argument index="0" name="property" type="String"> </argument> <description> - Returns the [Variant] value of the given [code]property[/code]. + Returns the [Variant] value of the given [code]property[/code]. If the [code]property[/code] doesn't exist, this will return [code]null[/code]. </description> </method> <method name="get_class" qualifiers="const"> @@ -454,6 +460,7 @@ </argument> <description> Assigns a script to the object. Each object can have a single script assigned to it, which are used to extend its functionality. + If the object already had a script, the previous script instance will be freed and its variables and state will be lost. The new script's [method _init] method will be called. </description> </method> <method name="to_string"> |