lua-users home
lua-l archive

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


On 11-10-15 05:22 PM, Sebastien Lai wrote:
Hello readers of lua-l,

I'm happy to announce a little utility of mine, called 'mergelua':
https://github.com/beelzebub/mergelua

This tool allows merging of (pure, noncompiled) Lua modules into a
single collective file.
It can be used to create packages of your Lua modules, similar to what
golang does, except that mergelua creates a single file.
Mergelua also features a local override of the 'require' function to
search the local moduletable first, and then execute the global
require() if the module does not exist in mergelua.

Synopsis:

     merge.lua<outputfilename>   <modulename>=<modulepath>
<anothermodule>=<anotherpath>

Example:

     merge.lua collection.lua oop=../oop.lua/oop.lua
configfile=../configfile/configfile.lua

There are probably a few things that might be tweaked:
    + minifying of Lua code (removing comments, newlines, etc)
    + support of bytecode-compiled chunks (unfortunately, I have yet to
find out how to store the data)
    + storing of .so / .dll files (same problem as above)

Please tell me what you think!


Hi Sabastien

I've been a bit rattled with the endless discussions of locals vs globals. I usually make a file copying script and concatenate the various files into one. I find it simpler and I figure it is easier to define scope with do - end blocks the the module mechanism. There isn't a whole lot of documentation for mergelua, is this essential what it does? I set up a configuration file and call mergelua on it?

Thanks for sharing your project with everyone-Patrick