[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Convention for naming Lua Module files
- From: Hisham <h@...>
- Date: Wed, 6 Apr 2016 18:46:55 -0300
On 6 April 2016 at 14:37, Derek Bailey <firstname.lastname@example.org> wrote:
> Is there a convention or pattern for naming Lua Module files (.dll) that
> indicate which Lua version they are built against?
> I built a module on Windows that targets Lua 5.1, 5.2, and 5.3, but I end up
> naming the resulting module file the same in all three cases (e.g.,
> mymodule.dll). So I just place them in three separate directories
> (51/mymodule.dll, 52/mymodule.dll, 53/mymodule.dll).
> Should I append the Lua version in the output file name somehow?
> (mymodule52.dll) The issue with that is the require() statement in the code
> now needs be updated to reflect that name change.
The convention on Unix is to use lib/5.1/mymodule.so,
lib/5.2/mymodule.so and lib/5.3/mymodule.so. Keeping the name as
mymodule.<extension> saves troubles with require() as you said, and
then it becomes only a matter of making LUA_CPATH (or LUA_CPATH_5_3
etc.) point to the right places (which is something you'll have to
deal with on Windows, anyway).
So in short, yeah, it's best to leave versioning to the directory name
and not the filename of the module.