lua-users home
lua-l archive

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


> (Yes, environment variables and paths are platform-specific.
> Hell, so are directories for that matter.;-)

That is all true (well, `getenv' is ANSI). But `require' should compile and 
run on any platform, as we do not use explicitly directories or paths in 
the implementation. We get a `getenv' or a global variable named LUA_PATH, 
break it along ';', concatenate each piece with the given file name, and 
try to run each result. All these operations (and their overall effect) 
have a clear and well-defined behaviour in any ANSI platform. For instance, 
if LUA_PATH="a;b;c" and you run "require d.lua", Lua will try to run the 
files 'ad.lua', 'bd.lua', and 'cd.lua'. The concepts of paths and 
directories are only a "standard" way to use the function
(for instance, saying LUA_PATH="/usr/local/lua/;./").

>Perhaps this is fruitful work for add-on libraries instead of language
>changes?

As lhf pointed out, require will be in a standard library, not in the 
kernel. The point of require being in the standard library is that it will 
give us more power to build other add-on libraries.  (If `require' was
implemented as a separate library, we would need it to load it ;-) Anyway,
as usual, it is too easy to remove it from lbaselib if you really need
a small implementation.

-- Roberto