GDScriptFunctionState.xml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.0.7">
  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. <demos>
  12. </demos>
  13. <methods>
  14. <method name="is_valid" qualifiers="const">
  15. <return type="bool">
  16. </return>
  17. <argument index="0" name="extended_check" type="bool" default="false">
  18. </argument>
  19. <description>
  20. Check whether the function call may be resumed. This is not the case if the function state was already resumed.
  21. 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.
  22. </description>
  23. </method>
  24. <method name="resume">
  25. <return type="Variant">
  26. </return>
  27. <argument index="0" name="arg" type="Variant" default="null">
  28. </argument>
  29. <description>
  30. Resume execution of the yielded function call.
  31. 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.
  32. This function returns what the resumed function call returns, possibly another function state if yielded again.
  33. </description>
  34. </method>
  35. </methods>
  36. <signals>
  37. <signal name="completed">
  38. <argument index="0" name="result" type="Nil">
  39. </argument>
  40. <description>
  41. </description>
  42. </signal>
  43. </signals>
  44. <constants>
  45. </constants>
  46. </class>