Datasheet
Assuming you have root privileges and want to make Lua available to all users of your system, execute
these commands:
su -
cd /tmp/lua5.1/bin/Linux24g3
mv lua5.1 /usr/local/bin/lua
mv luac5.1 /usr/local/bin/luac
chown root.root /usr/local/bin/{lua,luac}
chmod u=rwx,go=rx /usr/local/bin/{lua,luac}
cd /tmp
rm -fr lua5.1
exit
Now you should be able to execute lua without any path qualification, like this:
lua -v
Installing a Prebuilt Binary Package on Windows
If you are installing onto a 32-bit version of Windows, a safe bet is to select the package named
lua5_1_Win32_bin.tar.gz. This package uses the C runtime library MSVCRT.DLL, which is available
on all recent versions of Windows.
After you download one of the tarballs, you need to extract the package contents to a suitable location
using a utility such as Winzip or 7-zip. The following instructions assume you have downloaded the
package
lua5_1_Win32_bin.tar.gz and are using the 7-zip command-line utility—make the appro-
priate changes if you have selected a different package or are using a different extraction utility. Place
the package in the directory of your choice, and then execute the following commands at a shell prompt:
7z x lua5_1_Win32_bin.tar.gz
7z x lua5_1_Win32_bin.tar
del lua5_1_Win32_bin.tar
The following directory structure will be created:
lua5.1
bin
Win32
Four files are included in the Win32 subdirectory: the interpreter (lua5.1.exe), the byte-code compiler
(
luac5.1.exe), the Lua core in dynamic link library form (lua5.1.dll), and an embedding tool
(
bin2c5.1.exe). Change your default working directory to Win32 with the following command:
cd lua5.1\bin\Win32
Install the dynamic link library and executables as follows:
copy /b lua5.1.exe “%UTIL_DIR%\lua.exe”
copy /b luac5.1.exe “%UTIL_DIR%\luac.exe”
copy /b lua5.1.dll “%UTIL_DIR%\”
copy /b bin2c5.1.exe “%UTIL_DIR%\bin2c.exe”
20
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 20