lua-users home
lua-l archive

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


Okay, maybe I can explain my opinion better:

Previously I would write something like this if I wanted a temporary
package.path/cpath:

export LUA_PATH=/path1/modules/etc/
export LUA_CPATH=/path2/cmodules/etc/
lua some_script.lua
unset LUA_PATH
unset LUA_CPATH

To me this seemed inconvenient.  So Luiz and your solution is to use
`env' for portability and for just the one lua invocation makes more
sense as it's very temporary:  env LUA_PATH=/whatever lua etc...

My point is, for something this temporary I'd rather not modify the
environment.  I feel like it would be more convenient to type and
maybe a better idea to pass these paths directly to the lua binary
under a switch:

lua -path /whatever1/ -cpath /whatever2/ -l mod1 -l mod2 -e 'prior
code' script.lua -e 'io.read()'

^ Something like that, imo, would be nice.

My argument for avoiding the environment is that I used to write CGI
scripts with Lua, and I once wrote a very poor one that displayed
everything in the CGI script's environment to the web client.  It's
not a strong argument, but not leaking information about where modules
"are" in the environment might be a good thing.  Of course, I
eventually just modified the script to only display enviornment
variables I had whitelisted.  Anyway, I feel like the current argument
against -path/-cpath is that there is already a mechanism available
for this so why add another --> my argument is convenience mostly.

The third way is: -e 'package.path = package.path .. ';whatever1/'

All of this is irrelevant, I'm just leading the thread astray :\  ((sorry))