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-2016 Mike Pall. Coco is free software, released under the MIT license (same license as the Lua core).


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.


2016-07-17 Coco 1.1.9 has been released
GCC inline assembler context switching methods for ARM and ARM64 have been fixed.

Privacy Policy

This web site does not request, store or process any private data.

This web site is fully static and does not allow entry of personal information anywhere. It does not use cookies or any other form of tracking or analytics. Page visits and IP addresses are neither logged nor analyzed.