[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.2 beta: default module path incompatibility
- From: David Manura <dm.lua@...>
- Date: Wed, 21 Sep 2011 20:39:31 -0400
On Tue, Sep 20, 2011 at 7:26 AM, liam mail <firstname.lastname@example.org> wrote:
> On 20 September 2011 12:04, Dirk Laurie <email@example.com> wrote:
>> The default set in luaconf.h for both package.path and package.cpath
>> in Lua 5.2.0 beta puts the present working directory last, whereas in
>> Lua 5.1.4 it was put first.[...]
>> It is difficult to understand why this change has been made. It causes
>> any application distributed with customized versions of packages that
>> happen to installed system-wide to break unless the application explicitly
>> sets the path.
Arguments for the new behavior were raised in [1,2].
Note that the path "./?.lua" is relative to the current directory, but
you'd probably rather search relative to the Lua executable (i.e. "!"
style LUA_PATH in Windows / LuaDist setprogdir ) or relative to the
current script [4-8]. Perl's FindBin and "use lib"  do this well,
and I've contemplated writing the analogue of both modules for Lua,
and submitting it to distributions like LuaForWindows, because the
need is so common. IMO, "./?.lua" is a hack that introduces some
modes of failure.