Datasheet
Now create the actual directory that LUA_DIR identifies. Do this, as root, with the following command:
mkdir -p /usr/local/lib/lua/5.1
Environment Variables on Windows
Depending on which version of Windows you use, you modify the shell environment either through the
autoexec.bat file (Window 95, 98 and ME) or, for later versions, through a dedicated dialog box that
you get to through the System Properties dialog box. If you use
autoexec.bat, you set environment
variables with lines that look like the following:
SET LUA_DIR=”c:\program files\lua\5.1”
If you use the dedicated dialog box, you’ll need to choose between system variables and user variables.
In this window, you can add a new variable, edit an existing variable, or delete an existing variable.
When you add or edit a variable, there are separate input fields for the variable name and its value.
Within a shell script, surround an environment variable name with the
% character, as in — echo
%LUA_DIR%
.
The Windows Search Path
On a Windows system, whether you compile Lua or acquire a precompiled package, you’ll want to put
the Lua interpreter, compiler, and dynamic link library in a location that makes them easy to use. From a
shell prompt, the system should launch the interpreter when you execute the
lua command. There are
two practical approaches you can take: using aliases or using the search path.
When you’re at the shell prompt, Windows enables you to use a simple alias —
lua, for example — as a
replacement for a more complicated command, such as
c:\program files\utility\lua.exe. It
implements aliases like these, in addition to command-line editing and history, using
doskey. This
method may locate the aliased program slightly faster, but you cannot use the alias in a batch script.
Consult the output of the following to read more about this utility:
doskey /?
You can also use the Windows search path mechanism. When a command is invoked that is not internal
(such as
dir or del) and is not qualified with path information, Windows examines the search path,
looking for a matching executable. To see the current search path from the shell, execute this command:
path
In the following steps, you work with files and directories so you can use Windows Explorer if you like.
Complete these steps to move the Lua executables to a directory that is included in the Windows search
path:
1. If your current search path does not include a directory where you store utilities, create one
now (the directory
c:\program files\utility is assumed for this example, but the choice is
yours). Note that quotes are necessary when specifying names with spaces:
mkdir “c:\program files\utility”
5
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 5