[UNMAINTAINED] This library does not have a maintainer. The source code and repository will be kept at this URL indefinitely. If you'd like to help maintain this codebase, create an issue on this repo explaining why you'd like to become a maintainer and tag @tessel/maintainers in the body.
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.
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
git clone https://github.com/tessel/runtime.git
cd runtime
make update
make colony
make test
To link globally, run npm link --local
. 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.
Troubleshooting: If you're updating and have the error fatal: destination path 'deps/colony-luajit' already exists and is not an empty directory.
, run rm -rf deps/colony-luajit && make update
.
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.