how do i yield my code until a signal is emitted

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fat_furius

How do I make a for loop that yields a function until all the objects of an array emit a signal.
for example:

func example():
   #start of code
   for i in array:
       #yield code until every i emits a signal
    #resume code

What I have is:

func example():
   #start of code
   for i in array:
       yield(i,"signal")
    #resume code

But this only yields the code when the signal is emitted

:bust_in_silhouette: Reply From: Inces

You need to explain this some more :slight_smile:

your example function should hold whole loop until all nodes emit signals in correct sequence. It is not what You wanted ? What are these nodes supposed to be and in what pattern do they emit their signals ? Is it like gamephases commencing, when next player waits for his move in turn based game ? Or some call to return to formation when everyone finishes attack ?