LuaJIT

Last updated: 1 minute read.

Requirements

Tyk uses LuaJIT. The main requirement is the LuaJIT shared library, you may find this as libluajit-x in most distros.

For Ubuntu 14.04 you may use:

$ apt-get install libluajit-5.1-2 $ apt-get install luarocks

The LuaJIT required modules are as follows:

  • lua-cjson: in case you have luarocks, run: $ luarocks install lua-cjson

How to write LuaJIT Plugins

We have a demo plugin hosted in the repo tyk-plugin-demo-lua. The project implements a simple middleware for header injection, using a Pre hook (see Tyk custom middleware hooks) and mymiddleware.lua.

Lua Performance

Lua support is currently in beta stage. We are planning performance optimisations for future releases.

Tyk Lua API Methods

Tyk Lua API methods aren’t currently supported.