lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hugo Etchegoyen <hetchegoyen@hasar.com> writes:

> If I understood well, then one might say that resuming is like
> calling and yielding is like returning, the only difference being
> that the callee keeps the values of its local variables between
> invocations, and each time it is called it starts executing at the
> instruction following the last yield. Right?

And it keeps its whole call stack, too.  You can yield in the middle
of a called function.  Just like the caller (so coroutines are an
emancipation of subroutines, but there remain subtle differences).

Basically right.

-- 
David Kastrup