lua-users home
lua-l archive

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

>Would you give me a hint what is a `coroutine' and what are good at?

Coroutines, as the names suggests, are pieces of code that run "in parallel".
As such, they are similar to multiple threads, except that control is passed
from one coroutine to another in an explicit way, by calling a special transfer
function, whereas with threads the system interrupts them at unknown points.
In this sense, coroutines are much simpler than multiple threads.
So, that's the way we're going with Lua: the simpler thing first :-)

It's not too difficult to add them to Lua, because it runs a virtual machine,
but of course there are lots of details. In particular, we want to make sure
that external mechanisms for coroutines in C can blend well with coroutines
in Lua.

For one implementation of coroutines in C, written by Edgar Toernig, a member
of lua-l, see .