This page explains how to build Coco by modifying the original Lua sources.


Coco needs some machine-specific features — please have a look at the Portability Requirements.

Coco is distributed as a patch set against a specific version of the standard Lua distribution. You need to download the following file:

Next, you need the "patch" utility to apply the patch set. This program is available on most Linux or BSD distributions or can be installed from their package managers. Users of other operating systems should check out this Wiki page

To run the commands presented in the following sections, open a terminal/command window and change to the directory where you've downloaded the archives of the Lua sources and the Coco sources.

Unpacking and Patching

Either unpack the Lua sources and the Coco sources using an archive manager (e.g. the Windows Explorer) or run the following commands:

tar zxf LuaCoco-1.1.9.tar.gz
tar zxf lua-5.1.5.tar.gz
mv lua-5.1.5 lua-5.1.5-coco

Then change to the Lua source directory and apply the patch file which is distributed with the Coco sources:

cd lua-5.1.5-coco
patch -p1 <../LuaCoco-1.1.9/lua-5.1.5-coco-1.1.9.patch

Building Lua

Optionally modify any configuration files, then follow the installation instructions from the standard Lua sources. I.e. run make and supply your platform as a target, like:

make linux
  - or -
make macosx

Or use etc/luavs.bat to build Lua with MSVC.

Testing Coco

To check that your modified version of Lua works, try some simple tests:

./src/lua ../LuaCoco-1.1.9/test/cotest.lua
./src/lua ../LuaCoco-1.1.9/test/cocreate.lua
./src/lua ../LuaCoco-1.1.9/test/comessage.lua
./src/lua ../LuaCoco-1.1.9/test/chameneos.lua