lua-users home
lua-l archive

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

Quoting Dirk Laurie <>:

[Summary of thread: Some people would like Lua to add the directory
of the currently running main script automatically to the package path.
OP admits that other ways to achieve that effect exist but claims that
no good reason for Lua not to do so has been advanced. Several
posters have been stressing the other ways, but Russ keeps forcing
the issu back to "why not?" and is not impressed by the technical
arguments advanced so far.

Not to be nitpicky, the originally posted code does not add the current
main but rather the location of the last require() which keeps everything
relative to it's current location independent of main() or the
interpreters path.  I personally found it useful.  Less so in a big
application but more in a folder of scripts that share a utility module.
I'm not married to the idea it just makes my life easier and I was testing
the waters of how many people agree ... or not.  I'm enjoying the arguments
and they all have their merrits.  By the end of the day my patch solves my
problem, penlighs require_here solves a slightly different problem and non
of them may warrant to be included to be part of Luas original source.
But you'll never know if you don't talk about it.

I'm about to release a bigger library(network, asynchronous operations,
ordered hashtables, sets, unittesting, binary packing with bitlevel
resolution etc.) and there will be the require I posted be included.  I
just thought I asked if there is a bigger appetite for  it.