Co

Coco is a small extension to get True C Coroutine semantics for Lua 5.1. Coco is available as a patch set against the standard Lua 5.1.5 source distribution.

Coco is also integrated into LuaJIT 1.x to allow yielding for JIT compiled functions. But note that Coco does not depend on LuaJIT and works fine with plain Lua.

Coco is Copyright © 2004-2012 Mike Pall. Coco is free software, released under the MIT license (same license as the Lua core).

Features

True C coroutine semantics mean you can yield from a coroutine across a C call boundary and resume back to it. Coco allows you to use a dedicated C stack for each coroutine. Resuming a coroutine and yielding from a coroutine automatically switches C stacks. No changes are needed to your Lua source code.

In particular you can now:

Coco needs some machine-specific features, but runs fine on Linux, *BSD, Mac OS X, Windows and probably anything else you can find.

More ...

Please click on one of the links in the navigation bar to your left to learn more.

Please visit the Download page to fetch the current version of Coco.

News

2012-04-16 Coco 1.1.7 has been released
This release is now relative to Lua 5.1.5. Also, a setjmp context switching method for iOS has been added.