Function Call Vs Starting a sequence


ddl

Recommended Posts

I'm assuming you mean between calling a sequence as a function:

mySequence()

and starting it with beginseq():

beginseq(mySequence)

And the answer is absolutely. First, calling a sequence as a function causes the script that is calling the function to jump to that function and execute, then move to the next line only when it returns. It also means that any uncaught errors in the function will propagate back to the calling script. Starting a sequence using beginseq() causes a new thread of execution to be created and the sequence to run in that thread. This means that now the sequence and the calling script run concurrently and separate to one another. The calling script immediately moves to the next line, and any uncaught errors in the sequence just started do not propagate back, but merely stop that sequence. One other difference is that you can only pass parameters to and receive values back from sequences called as a function, not ones started with beginseq().

So, basically, when you want to pass parameters, or receive a result from a sequence, or you need the script to wait until the sequence is finished, you should call the sequence as a function. If, however, you want to start some other task with the other sequence, and then forget about it and have your script continue on, then use beginseq().

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.