class_gdscriptfunctionstate.rst 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/gdscript/doc_classes/GDScriptFunctionState.xml.
  6. .. _class_GDScriptFunctionState:
  7. GDScriptFunctionState
  8. =====================
  9. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. State of a function call after yielding.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Calling :ref:`@GDScript.yield<class_@GDScript_method_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 :ref:`resume<class_GDScriptFunctionState_method_resume>` on this state object.
  15. .. rst-class:: classref-reftable-group
  16. Methods
  17. -------
  18. .. table::
  19. :widths: auto
  20. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`is_valid<class_GDScriptFunctionState_method_is_valid>` **(** :ref:`bool<class_bool>` extended_check=false **)** |const| |
  22. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Variant<class_Variant>` | :ref:`resume<class_GDScriptFunctionState_method_resume>` **(** :ref:`Variant<class_Variant>` arg=null **)** |
  24. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
  25. .. rst-class:: classref-section-separator
  26. ----
  27. .. rst-class:: classref-descriptions-group
  28. Signals
  29. -------
  30. .. _class_GDScriptFunctionState_signal_completed:
  31. .. rst-class:: classref-signal
  32. **completed** **(** :ref:`Variant<class_Variant>` result **)**
  33. .. container:: contribute
  34. There is currently no description for this signal. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  35. .. rst-class:: classref-section-separator
  36. ----
  37. .. rst-class:: classref-descriptions-group
  38. Method Descriptions
  39. -------------------
  40. .. _class_GDScriptFunctionState_method_is_valid:
  41. .. rst-class:: classref-method
  42. :ref:`bool<class_bool>` **is_valid** **(** :ref:`bool<class_bool>` extended_check=false **)** |const|
  43. Check whether the function call may be resumed. This is not the case if the function state was already resumed.
  44. If ``extended_check`` is enabled, it also checks if the associated script and object still exist. The extended check is done in debug mode as part of :ref:`resume<class_GDScriptFunctionState_method_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.
  45. .. rst-class:: classref-item-separator
  46. ----
  47. .. _class_GDScriptFunctionState_method_resume:
  48. .. rst-class:: classref-method
  49. :ref:`Variant<class_Variant>` **resume** **(** :ref:`Variant<class_Variant>` arg=null **)**
  50. Resume execution of the yielded function call.
  51. If handed an argument, return the argument from the :ref:`@GDScript.yield<class_@GDScript_method_yield>` call in the yielded function call. You can pass e.g. an :ref:`Array<class_Array>` to hand multiple arguments.
  52. This function returns what the resumed function call returns, possibly another function state if yielded again.
  53. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  54. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  55. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  56. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`