6.22. Using Lua

This section describes the status of the Lua libraries in the ports tree and its integration with the ports system.

6.22.1. Introduction

There are many versions of the Lua libraries and corresponding interpreters, which conflict between them (install files under the same name). In the ports tree this problem has been solved by installing each version under a different name using version number suffixes.

The obvious disadvantage of this is that each application has to be modified to find the expected version. But it can be solved by adding some additional flags to the compiler and linker.

6.22.2. Version Selection

A port using Lua only needs to have this line:

USES=	lua

If a specific version of Lua is needed, instructions on how to select it are given in the USES=lua part of Chapter 17, Using USES Macros.

6.22.3. Defined Variables

These variables are available in the port.

Table 6.39. Variables Defined for Ports That Use Lua
LUA_VERThe Lua version that is going to be used (for example, 5.1)
LUA_VER_STRThe Lua version without the dots (for example, 51)
LUA_PREFIXThe prefix where Lua (and components) is installed
LUA_SUBDIRThe directory under ${PREFIX}/bin, ${PREFIX}/share and ${PREFIX}/lib where Lua is installed
LUA_INCDIRThe directory where Lua and tolua header files are installed
LUA_LIBDIRThe directory where Lua and tolua libraries are installed
LUA_MODLIBDIRThe directory where Lua module libraries (.so) are installed
LUA_MODSHAREDIRThe directory where Lua modules (.lua) are installed
LUA_PKGNAMEPREFIXThe package name prefix used by Lua modules
LUA_CMDThe path to the Lua interpreter
LUAC_CMDThe path to the Lua compiler

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.