summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-29 13:54:42 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-29 13:54:42 +0100
commitdc87f05f4400efeb8a575aad1e72cdef57ccf7b8 (patch)
treeed34a325559e6386a7a0a05a7d375e15de34bdbf
parent7434f8b4e3af0014ed55f4f2058c2e31a53305bf (diff)
parent1cc5b0aa0d2ab0da6c82cad736e9cd50b0771251 (diff)
downloadredot-engine-dc87f05f4400efeb8a575aad1e72cdef57ccf7b8.tar.gz
Merge pull request #88961 from AThousandShips/deferred_doc
[Doc] Clarify some details about deferred calls
-rw-r--r--doc/classes/Callable.xml1
-rw-r--r--doc/classes/Object.xml2
2 files changed, 2 insertions, 1 deletions
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml
index bd56d6ab80..3965fd4f8f 100644
--- a/doc/classes/Callable.xml
+++ b/doc/classes/Callable.xml
@@ -127,6 +127,7 @@
}
[/csharp]
[/codeblocks]
+ [b]Note:[/b] Deferred calls are processed at idle time. Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
See also [method Object.call_deferred].
</description>
</method>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index 307eaa5e00..724c9a38d8 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -406,7 +406,7 @@
<param index="0" name="method" type="StringName" />
<description>
Calls the [param method] on the object during idle time. Always returns null, [b]not[/b] the method's result.
- Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. If not done carefully, this can result in infinite recursion without causing a stack overflow, which will hang the game similarly to an infinite loop.
+ Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they'll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
[codeblocks]
[gdscript]