GDScriptFunctionState.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="GDScriptFunctionState" inherits="Reference" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
  3. <brief_description>
  4. State of a function call after yielding.
  5. </brief_description>
  6. <description>
  7. Calling [method @GDScript.yield] within a function will cause that function to yield and return its current state as an object of this type. The yielded function call can then be resumed later by calling [method resume] on this state object.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="is_valid" qualifiers="const">
  13. <return type="bool" />
  14. <argument index="0" name="extended_check" type="bool" default="false" />
  15. <description>
  16. Check whether the function call may be resumed. This is not the case if the function state was already resumed.
  17. If [code]extended_check[/code] is enabled, it also checks if the associated script and object still exist. The extended check is done in debug mode as part of [method GDScriptFunctionState.resume], but you can use this if you know you may be trying to resume without knowing for sure the object and/or script have survived up to that point.
  18. </description>
  19. </method>
  20. <method name="resume">
  21. <return type="Variant" />
  22. <argument index="0" name="arg" type="Variant" default="null" />
  23. <description>
  24. Resume execution of the yielded function call.
  25. If handed an argument, return the argument from the [method @GDScript.yield] call in the yielded function call. You can pass e.g. an [Array] to hand multiple arguments.
  26. This function returns what the resumed function call returns, possibly another function state if yielded again.
  27. </description>
  28. </method>
  29. </methods>
  30. <signals>
  31. <signal name="completed">
  32. <argument index="0" name="result" type="Variant" />
  33. <description>
  34. </description>
  35. </signal>
  36. </signals>
  37. <constants>
  38. </constants>
  39. </class>