This is the runtime and JavaScript engine that runs on Tessel, built on Lua's VM. It can be run independently on PC or embedded.
git clone --recursive https://github.com/tessel/runtime.git
Building the firmware requires gyp, and ninja, and gcc-arm-embedded when building for embedded.
To install quickly on a Mac with Brew:
brew tap tessel/tools
brew install gyp ninja
brew install gcc-arm # to build for embedded
All dependencies are in the Ubuntu 14.04 repositories:
sudo apt-get install git nodejs npm nodejs-legacy gyp ninja-build
sudo apt-get install gcc-arm-none-eabi # to build for embedded
npm install
npm install -g colony-compiler
make colony
npm link --local
npm test
You can now run code on your PC using colony
from your command line (e.g. colony hello-world.js
). For building firmware, please see the firmware building instructions.
Colony has support for interacting with the Lua API for handling basic JavaScript primitives. These are included via colony.h
.
# void colony_createarray ( lua_State* L, int size )
Creates a new JavaScript array of length size
. This sets the object prototype as well as the initial length of the array.
# void colony_createobj ( lua_State* L, int size, int proto )
Creates a new JavaScript object with an expected (but not required) allocation of size
keys. This sets the object prototype as well. If proto
is not zero (an invalid stack pointer), it points to an object on the stack to be used as the prototype for the newly created object.
MIT or Apache 2.0, at your option.