lua-users home
lua-l archive

Re: What's the difference between a "coroutine" and a "thread" in Lua?

[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

AltStyle によって変換されたページ (->オリジナル) /