lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 4/22/05, whisper@oz.net <whisper@oz.net> wrote:
> E:\Lua\luasocket-2.0-beta3\tests>set
> LUA_INIT=e:/lua/lua-5.1w5/bin/compat-5.1.lua

To specify a file name in LUA_INIT, the string needs to start with a @
char, or else it will be interpreted as a lua script.

> E:\Lua\luasocket-2.0-beta3\tests>lua testsrvr.lua
> lua: LUA_INIT:1: `<name>' expected near `/'

Here it tried to execute the lua script with contents
"e:/lua/lua-5.1w5/bin/compat-5.1.lua" which is not valid sintax...

> E:\Lua\luasocket-2.0-beta3\tests>set LUA_INIT=@<ROOT>/compat-5.1.lua
> The system cannot find the file specified.

The problem here is the use of '<' and '>' which will tell the windows
console to interpret as redirection files. It will try to read from
file "ROOT" and output the result of the command "set LUA_INIT=@" into
"/compat-5.1.lua". Since the file ROOT was not found nothing was
changed.

> E:\Lua\luasocket-2.0-beta3\tests>set Lua_Init=compat-5.1.lua

You should have typed "set LUA_INIT=@compat-5.1.lua".


I hope this helps you understand what you were doing wrong.

For more information, see: http://www.lua.org/manual/5.0/manual.html#6

"Before running any argument, the interpreter checks for an
environment variable LUA_INIT. If its format is @filename, then lua
executes the file. Otherwise, lua executes the string itself."

Tiago