summaryrefslogtreecommitdiff
path: root/doc/classes/Callable.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Callable.xml')
-rw-r--r--doc/classes/Callable.xml42
1 files changed, 25 insertions, 17 deletions
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml
index f137ede90f..0cfbd0270c 100644
--- a/doc/classes/Callable.xml
+++ b/doc/classes/Callable.xml
@@ -8,26 +8,26 @@
[b]Example:[/b]
[codeblocks]
[gdscript]
- var callable = Callable(self, "print_args")
func print_args(arg1, arg2, arg3 = ""):
prints(arg1, arg2, arg3)
func test():
- callable.call("hello", "world") # Prints "hello world".
+ var callable = Callable(self, "print_args")
+ callable.call("hello", "world") # Prints "hello world ".
callable.call(Vector2.UP, 42, callable) # Prints "(0, -1) 42 Node(Node.gd)::print_args".
callable.call("invalid") # Invalid call, should have at least 2 arguments.
[/gdscript]
[csharp]
- Callable callable = new Callable(this, "print_args");
- public void PrintArgs(object arg1, object arg2, object arg3 = "")
+ public void PrintArgs(object arg1, object arg2, object arg3 = null)
{
GD.PrintS(arg1, arg2, arg3);
}
public void Test()
{
- callable.Call("hello", "world"); // Prints "hello world".
- callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.gd)::print_args".
+ Callable callable = new Callable(this, nameof(PrintArgs));
+ callable.Call("hello", "world"); // Prints "hello world null".
+ callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.cs)::PrintArgs".
callable.Call("invalid"); // Invalid call, should have at least 2 arguments.
}
[/csharp]
@@ -63,69 +63,74 @@
Creates a new [Callable] for the method called [code]method[/code] in the specified [code]object[/code].
</description>
</method>
- <method name="bind" qualifiers="vararg">
+ <method name="bind" qualifiers="vararg const">
<return type="Callable">
</return>
<description>
+ Returns a copy of this [Callable] with the arguments bound. Bound arguments are passed after the arguments supplied by [method call].
</description>
</method>
- <method name="call" qualifiers="vararg">
+ <method name="call" qualifiers="vararg const">
<return type="Variant">
</return>
<description>
Calls the method represented by this [Callable]. Arguments can be passed and should match the method's signature.
</description>
</method>
- <method name="call_deferred" qualifiers="vararg">
+ <method name="call_deferred" qualifiers="vararg const">
<return type="void">
</return>
<description>
Calls the method represented by this [Callable] in deferred mode, i.e. during the idle frame. Arguments can be passed and should match the method's signature.
</description>
</method>
- <method name="get_method">
+ <method name="get_method" qualifiers="const">
<return type="StringName">
</return>
<description>
Returns the name of the method represented by this [Callable].
</description>
</method>
- <method name="get_object">
+ <method name="get_object" qualifiers="const">
<return type="Object">
</return>
<description>
Returns the object on which this [Callable] is called.
</description>
</method>
- <method name="get_object_id">
+ <method name="get_object_id" qualifiers="const">
<return type="int">
</return>
<description>
Returns the ID of this [Callable]'s object (see [method Object.get_instance_id]).
</description>
</method>
- <method name="hash">
+ <method name="hash" qualifiers="const">
<return type="int">
</return>
<description>
+ Returns the hash value of this [Callable]'s object.
</description>
</method>
- <method name="is_custom">
+ <method name="is_custom" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if this [Callable] is a custom callable whose behavior differs based on implementation details. Custom callables are used in the engine for various reasons. If [code]true[/code], you can't use [method get_method].
</description>
</method>
- <method name="is_null">
+ <method name="is_null" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if this [Callable] has no target to call the method on.
</description>
</method>
- <method name="is_standard">
+ <method name="is_standard" qualifiers="const">
<return type="bool">
</return>
<description>
+ Returns [code]true[/code] if this [Callable] is a standard callable, referencing an object and a method using a [StringName].
</description>
</method>
<method name="operator !=" qualifiers="operator">
@@ -134,6 +139,7 @@
<argument index="0" name="right" type="Callable">
</argument>
<description>
+ Returns [code]true[/code] if both [Callable]s invoke different targets.
</description>
</method>
<method name="operator ==" qualifiers="operator">
@@ -142,14 +148,16 @@
<argument index="0" name="right" type="Callable">
</argument>
<description>
+ Returns [code]true[/code] if both [Callable]s invoke the same custom target.
</description>
</method>
- <method name="unbind">
+ <method name="unbind" qualifiers="const">
<return type="Callable">
</return>
<argument index="0" name="argcount" type="int">
</argument>
<description>
+ Returns a copy of this [Callable] with the arguments unbound. Calling the returned [Callable] will call the method without the extra arguments that are supplied in the [Callable] on which you are calling this method.
</description>
</method>
</methods>