[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Top-level source file name for a package: "?.lua", "?/?.lua", or "?/init.lua"?
- From: "Hisham Muhammad" <hisham.hm@...>
- Date: Mon, 7 Jan 2008 23:07:10 -0200
On Jan 7, 2008 12:17 PM, Andre Carregal <firstname.lastname@example.org> wrote:
> On Jan 6, 2008 3:06 AM, Matt Campbell <email@example.com> wrote:
> > I've observed three naming conventions for the top-level source file of
> > a Lua package, where '?' represents the name of the package: "?.lua",
> > "?/?.lua", and "?/init.lua". The first and third conventions are
> > supported by the default package.path in Lua 5.1. The first is used in
> > the Kepler binary distribution (at least on Windows), and the second is
> > used in the source trees of Kepler packages like CGILua and Xavante. I
> > haven't yet seen anyone else use the third, though I use it myself.
> > Which is best? I'm especially curious to know why the Kepler project
> > uses different naming conventions in its source and binary
> > distributions, and why its source trees use a naming convention that
> > Lua's default configuration doesn't support.
> This is due to the changes in the default path values used by Lua 5.0,
> Compat-5.1 and Lua 5.1.
> Lua 5.0 used "?;?.lua" and Compat-5.1 started using "?.lua;?/?.lua"
> but then added "?/init.lua" as Lua 5.1 started using it. By then every
> Kepler module was already assuming the "?/?.lua" which was not adopted
> by Lua 5.1.
> In order to make things easier on the CVS side we decided to simply
> add makefile rules to handle the difference, moving
> /xavante/xavante.lua to /xavante.lua on the make step for example.
So, to put it shortly: Kepler does not use the second approach
(?/?.lua) anymore. Either the first (?.lua) and third (?/init.lua) are
fine, given they're both supported by vanilla Lua.
Kepler used to stray from the vanilla way of doing things in Lua more
than it does now. It now follows the default Lua conventions for paths
and no longer forcibly expects a custom-named interpreter (though it
still cas use them), allowing vanilla and Linux-distro builds of Lua
to be used along with Kepler.