.. index:: lua
.. _lua:
Lua
===
Description
-----------
Lua is a powerful, fast, lightweight scripting language. It is particularly well-suited to being embedded as part of a compiled program to provide, for example, a user interface and scripting functionality.
User instructions
-----------------
Lua 5.2.4 is installed on all machines. Other versions of lua, along with libraries and headers, are available via the modules system. To add it to your environment run (e.g.):
.. code-block:: bash
$ module load lua/5.3.4
Extensive documentation is available on the `lua website `_. For embedding with Fortran I recommend `AOTUS `_, the authors of which are very receptive to ideas and contributions.
Source
------
http://www.lua.org/
License
-------
MIT License.
Admin notes
-----------
Very easy and very fast: it's only around 20000 lines of C!
.. code-block:: bash
wget -O - http://www.lua.org/ftp/lua-5.3.4.tar.gz | tar xvzf -
cd lua-5.3.4
make linux -j2
make test
make install INSTALL_TOP=/common/debian/9.1/Core/lua/lua-5.3.4
Given the slight incompatibilities between lua versions, I installed the latest versions in the 5.1, 5.2 and 5.3 series.
.. warning::
We currently don't have any lua modules installed as part of the lua system so the following is just a note work.
lua searches for modules using LUA_PATH (for pure lua modules) and LUA_CPATH (for shared libraries). If these are set, then they completely override the defaults (rather than extend them). This means that if an environment module is loaded which sets LUA_PATH and LUA_CPATH, lua can't find any of its built-in libraries! My solution was to run lua:
.. code-block:: bash
$ lua -e "print(package.path, package.cpath)"
and using the default settings to set LUA_PATH and LUA_CPATH in a custom module file. Hacky but functional.