Getting Started =============== Please jump to `Using the Library`_ section if you are familiar with Lua and LuaJIT. .. contents:: Prerequisites ------------- The library is designed for LuaJIT_. **LuaJIT 2.1 alpha** is high^W **Highly** recommended for performance reasons. Lua 5.1--5.3 are also supported. The library is platform-independent and expected to work on all platforms that supported by Lua(JIT). It can be also used in any Lua(JIT) based applications, e.g. Tarantool_ or OpenResty_. You might need diff_ tool to run test system and sphinx_ to regenerate the documentation from source files. .. _LuaJIT: http://luajit.org/ .. _Tarantool: http://tarantool.org/ .. _OpenResty: http://openresty.org/ .. _diff: http://en.wikipedia.org/wiki/Diff .. _sphinx: http://sphinx-doc.org/ Installing LuaJIT ----------------- You can build LuaJIT from sources or install it from a binary archive. From Sources ```````````` 1. Clone LuaJIT git repository. Please note that **v2.1** branch is needed. You can always select this branch using ``git checkout v2.1``. .. code-block:: bash $ git clone http://luajit.org/git/luajit-2.0.git -b v2.1 luajit-2.1 Cloning into 'luajit-2.1'... 2. Compile LuaJIT .. code-block:: bash $ cd luajit-2.1/ luajit-2.1 $ make -j8 3. Install LuaJIT .. code-block:: bash luajit-2.1 $ make install luajit-2.1 $ ln -s /usr/local/bin/luajit-2.1.0-alpha /usr/local/bin/luajit Install operation might require root permissions. However, you can install LuaJIT into your home directory. From a Binary Archive ````````````````````` If operations above look too complicated for you, you always can download a binary archive from http://luajit.org/download.html page. Your favorite package manager may also have LuaJIT packages. Running LuaJIT `````````````` Ensure that freshly installed LuaJIT works: .. code-block:: bash $ luajit LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/ JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse > = 2 + 2 4 It is good idea to use LuaJIT CLI under ``rlwrap`` (on nix platforms): .. code-block:: bash alias luajit="rlwrap luajit" $ luajit LuaJIT 2.1.0-alpha -- Copyright (C) 2005-2013 Mike Pall. http://luajit.org/ JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse > = 2 + 2 4 > = 2 + 2