class_gdfunctionstate.rst 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_GDFunctionState:
  4. GDFunctionState
  5. ===============
  6. **Inherits:** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. State of a function call after yielding.
  11. Member Functions
  12. ----------------
  13. +--------------------------------+------------------------------------------------------------------------------------------------------------------+
  14. | :ref:`bool<class_bool>` | :ref:`is_valid<class_GDFunctionState_is_valid>` **(** :ref:`bool<class_bool>` extended_check=false **)** const |
  15. +--------------------------------+------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`Variant<class_variant>` | :ref:`resume<class_GDFunctionState_resume>` **(** :ref:`Variant<class_variant>` arg=NULL **)** |
  17. +--------------------------------+------------------------------------------------------------------------------------------------------------------+
  18. Description
  19. -----------
  20. Calling :ref:`@GDScript.yield<class_@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 :ref:`resume<class_GDFunctionState_resume>` on this state object.
  21. Member Function Description
  22. ---------------------------
  23. .. _class_GDFunctionState_is_valid:
  24. - :ref:`bool<class_bool>` **is_valid** **(** :ref:`bool<class_bool>` extended_check=false **)** const
  25. Check whether the function call may be resumed. This is not the case if the function state was already resumed.
  26. 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:`GDFunctionState.resume<class_GDFunctionState_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.
  27. .. _class_GDFunctionState_resume:
  28. - :ref:`Variant<class_variant>` **resume** **(** :ref:`Variant<class_variant>` arg=NULL **)**
  29. Resume execution of the yielded function call.
  30. If handed an argument, return the argument from the :ref:`@GDScript.yield<class_@GDScript_yield>` call in the yielded function call. You can pass e.g. an :ref:`Array<class_array>` to hand multiple arguments.
  31. This function returns what the resumed function call returns, possibly another function state if yielded again.