Datasheet

One of the most popular packages maintained at LuaForge is LuaBinaries, a set of ready-made Lua pack-
ages (
http://luaforge.net/projects/luabinaries/). In the file download section of the LuaBinaries
site is a list of files that includes entries like these:
lua5_1_Win32_bin.tar.gz 82060 1,376 Intel x86 .gz
lua5_1_Linux26_bin.tar.gz 127132 80 Intel x86 .gz
The names of these files include abbreviated information about their contents. For more detailed infor-
mation about each of the packages, read the packaging file (
apackaging_lua5.1.html) located in the
same directory. It will help you select the appropriate package for your platform.
Installing a Prebuilt Binary Package
on a Unix-Type System
After you have selected the appropriate tarball from the LuaBinaries site, download it and place it in
the
/tmp directory. The following commands assume you have selected lua5_1_Linux24g3_bin.tar
.gz
make the appropriate changes if necessary. Unpack it as follows:
cd /tmp
tar xzvf lua5_1_Linux24g3_bin.tar.gz
This creates the following directory structure:
lua5.1
bin
Linux24g3
In the Linux24g3 subdirectory are three files: the interpreter (lua5.1), the byte-code compiler
(
luac5.1), and a utility that helps with embedding Lua scripts into C programs (bin2c5.1). Make sure
the interpreter works with your system, as follows:
lua5.1/bin/Linux24g3/lua5.1 -v
This should result in the following output:
Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
You should get the same response when invoking the compiler with the -v switch. If you don’t get this,
you’ve likely selected a binary package that is incompatible with your operating system.
If the interpreter and compiler work with your system, move them to a location in your search path. If
you have root privileges and want to make Lua available to all users of your system, the location
/usr/
local/bin
is traditional. If you lack sufficient privileges or are interested only in using Lua yourself, the
bin directory beneath your home directory is a good location. In this last case, you may need to create
the
bin subdirectory and set it as part of your PATH environment variable.
19
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 19