lua-users home
lua-l archive

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


Tiago Dionizio wrote:

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


Thanks for the clarification on LUA_INIT!

While my copy of the Lua book is dog-eared I've read it so much, I'm still new to Lua (old in the ways fo programming though! ;))

I used the @<ROOT> idiom because I think that's what the LuaSocket doc said to do. Not knowing any better, I followed it to the letter where I should have recognized the spirit. Some days the force just isn't with me ;)

With your explanation and a more rested pair of eyes, I can see that LuaSocket's doc is fine and it's my error.

Regards,

Dave LeBlanc
Seattle, WA USA