Re: CoCo in 2.0.2

  • From: Mike Pall <mike-1309@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 5 Sep 2013 15:38:55 +0200

Ani A wrote:
> Is CoCo (coroutine) library integrated in LuaJIT2.0.2 ?
> (the coco page says that it is integrated in LuaJIT1.x, but
> does not mention 2.x). If it is not integrated by default, is there
> a separate patch for LuaJIT2.x ?

CoCo is LuaJIT 1.x only. LuaJIT 2.x has a fully resumable VM, so
there's little need for CoCo anymore. You can yield() across
iterators, across metamethods, across pcall() etc.

The only thing that doesn't work is yielding when the coroutine
has a C function further down in the stack. Note that pcall() and
others are builtins and not C functions, so this restriction
doesn't apply for them.

--Mike

Other related posts: