lua-users home
lua-l archive

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

On Tue, Nov 21, 2017 at 05:48 Dirk Laurie <> wrote:
Lua allows "require mymod" where "mymod" is a directory containing
anything, but including a file named "init.lua". This nicely solves

the problem of organizing one's code in a readable way while still not
expecting the user to make zillions of requires.

This is how I do it. It means making a master module for your environment. That .init file can do lots of fun stuff for you. It’s where I put all sorts of dangerous behavior, like overloading the string metatable to allow for some additional fun with the % sign and other monkey patching.

Having internal modules is fun. 


Don't you do that
with Penlight, Steve?

2017-11-21 13:42 GMT+02:00 steve donovan <>:
> On Tue, Nov 21, 2017 at 3:49 PM, dyngeccetor8 <> wrote:
>> Unlike 'npm' way I deploy code with all used modules. So there is zero external
>> dependencies and no need to keep backward compatibility.
> I've always tended to that, to the point where I would release
> single-file 5000 line applications. Not really so good!
> However, it is not difficult to squeeze all needed little modules into
> a single archive - I've used Jay Carlson's soar to do this.
> With little modules, you then get 'smart linking' - only the code you
> use is included. Smart linking larger modules is harder to get right!