diff options
Diffstat (limited to 'doc/classes/Object.xml')
-rw-r--r-- | doc/classes/Object.xml | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 9ad79dc17a..ed045f8390 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -13,15 +13,15 @@ [codeblocks] [gdscript] var n = Node2D.new() - print("position" in n) # Prints "True". - print("other_property" in n) # Prints "False". + print("position" in n) # Prints "true". + print("other_property" in n) # Prints "false". [/gdscript] [csharp] var node = new Node2D(); // C# has no direct equivalent to GDScript's `in` operator here, but we // can achieve the same behavior by performing `Get` with a null check. - GD.Print(node.Get("position") != null); // Prints "True". - GD.Print(node.Get("other_property") != null); // Prints "False". + GD.Print(node.Get("position") != null); // Prints "true". + GD.Print(node.Get("other_property") != null); // Prints "false". [/csharp] [/codeblocks] The [code]in[/code] operator will evaluate to [code]true[/code] as long as the key exists, even if the value is [code]null[/code]. @@ -92,12 +92,12 @@ Calls the [code]method[/code] on the object and returns the result. This method supports a variable number of arguments, so parameters are passed as a comma separated list. Example: [codeblocks] [gdscript] - var node = Node2D.new() - node.call("set", "position", Vector2(42, 0)) + var node = Node3D.new() + node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571) [/gdscript] [csharp] - var node = new Node2D(); - node.Call("set", "position", new Vector2(42, 0)); + var node = new Node3D(); + node.Call("rotate", new Vector3(1f, 0f, 0f), 1.571f); [/csharp] [/codeblocks] [b]Note:[/b] In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase). @@ -110,12 +110,12 @@ 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: [codeblocks] [gdscript] - var node = Node2D.new() - node.call_deferred("set", "position", Vector2(42, 0)) + var node = Node3D.new() + node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571) [/gdscript] [csharp] - var node = new Node2D(); - node.CallDeferred("set", "position", new Vector2(42, 0)); + var node = new Node3D(); + node.CallDeferred("rotate", new Vector3(1f, 0f, 0f), 1.571f); [/csharp] [/codeblocks] [b]Note:[/b] In C#, the method name must be specified as snake_case if it is defined by a built-in Godot node. This doesn't apply to user-defined methods where you should use the same convention as in the C# source (typically PascalCase). @@ -129,12 +129,12 @@ Calls the [code]method[/code] on the object and returns the result. Contrarily to [method call], this method does not support a variable number of arguments but expects all parameters to be via a single [Array]. [codeblocks] [gdscript] - var node = Node2D.new() - node.callv("set", ["position", Vector2(42, 0)]) + var node = Node3D.new() + node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571]) [/gdscript] [csharp] - var node = new Node2D(); - node.Callv("set", new Godot.Collections.Array { "position", new Vector2(42, 0) }); + var node = new Node3D(); + node.Callv("rotate", new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); [/csharp] [/codeblocks] </description> @@ -331,7 +331,8 @@ <method name="get_class" qualifiers="const"> <return type="String" /> <description> - Returns the object's class as a [String]. + Returns the object's class as a [String]. See also [method is_class]. + [b]Note:[/b] [method get_class] does not take [code]class_name[/code] declarations into account. If the object has a [code]class_name[/code] defined, the base class name will be returned instead. </description> </method> <method name="get_incoming_connections" qualifiers="const"> @@ -441,7 +442,8 @@ <return type="bool" /> <argument index="0" name="class" type="String" /> <description> - Returns [code]true[/code] if the object inherits from the given [code]class[/code]. + Returns [code]true[/code] if the object inherits from the given [code]class[/code]. See also [method get_class]. + [b]Note:[/b] [method is_class] does not take [code]class_name[/code] declarations into account. If the object has a [code]class_name[/code] defined, [method is_class] will return [code]false[/code] for that name. </description> </method> <method name="is_connected" qualifiers="const"> |