about · installation · changes · license · reference manual
Lua's official web site provides complete information about Lua, including an executive summary and updated documentation, especially the reference manual, which may differ slightly from the local copy distributed in this package.
The instructions below are for Unix-like platforms. There are also instructions for other systems. See below for customization options.
aix ansi bsd freebsd generic linux macosx mingw posix solaris
If your platform is listed, just do "make xxx", where xxx is your platform name.
If your platform is not listed, try the closest one or posix, generic, ansi, in this order.
If you want to build and install Lua in one step, do "make xxx install", where xxx is your platform name.
If you want to install Lua locally, then do "make local". This will create a directory install with subdirectories bin, include, lib, man, and install Lua there as follows:
There are man pages for lua and luac, in both nroff and html, and a reference manual in html in doc, some sample code in test, and some useful stuff in etc. You don't need these directories for development.
If you want to install Lua locally, but in some other directory, do "make install INSTALL_TOP=xxx", where xxx is your chosen directory.
You don't actually need to edit the Makefiles because you may set the relevant variables in the command line when invoking make.
On the other hand, if you need to customize some Lua features, you'll need to edit src/luaconf.h before building and installing Lua. The edited file will be the one installed, and it will be used by any Lua clients that you build, to ensure consistency. (Further customization is possible by editing the Lua sources.)
We strongly recommend that you enable dynamic loading. This is done automatically for all platforms listed above that have this feature and also for Windows.
If all you want is to build the Lua interpreter, you may put all .c files in a single project, except for luac.c and print.c. Or just use etc/one.c.
To use Lua as a library in your own programs you'll need to know how to create and use libraries with your compiler. Moreover, to dynamically load C libraries for Lua you'll need to know how to create dynamic libraries and you'll need to make sure that the Lua API functions are accessible to those dynamic libraries — but you do not want to link the Lua library into each dynamic library. For Unix, we recommend that the Lua library be linked statically into the host program and its symbols exported for dynamic linking; src/Makefile does this for the Lua interpreter. For Windows, we recommend that the Lua library be a DLL.
As mentioned above, you may edit src/luaconf.h to customize some features before building Lua.
Here are the main changes since the previous work version:
_ENV
proposal
lua_absindex
io.lines
Here are the main changes in Lua since its last release. The reference manual lists the incompatibilities that had to be introduced.
__len
metamethod.
__pairs
and __ipairs
.
xpcall
.
loadlib
may load libraries with global names (RTLD_GLOBAL).
package.searchpath
.
math.log
.
file:write
returns file
.
os.exit
may close state.
collectgarbage
and lua_gc
.
ipairs
now goes until #t.
lua_cpcall
changed to a predefined function in the registry.
LUA_OK
and LUA_ERRGCMM
.
lua_compare
, lua_arith
, and lua_len
.
lua_version
and luaL_version
.
lua_pushstring
and pushlstring
return string.
luaL_testudata
.
luaL_tolstring
.
lua_copy
.
lua_upvalueid
and lua_upvaluejoin
.
nparams
and isvarag
available in debug API.
Copyright © 1994–2010 Lua.org, PUC-Rio.Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.