lua-users home
lua-l archive

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

On 6 April 2016 at 14:37, Derek Bailey <> 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/,
lib/5.2/ and lib/5.3/ 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.

-- Hisham