[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] mergelua
- From: Krunal Rao <krunal.rao78@...>
- Date: Tue, 18 Oct 2011 20:48:16 +0100
On 18 October 2011 19:50, Petite Abeille <petite.abeille@gmail.com> wrote:
> Ought to stay to provide a standard implementation for modules.
I admit I truly do not understand why you insist on Lua lacking a
"standard implementation for modules" without module() (pun intended).
What is wrong with having modules defined as Luiz and Mike (and others) suggest:
local _M = {}
-- whatever, put stuff that belongs to the module in _M
return _M
It's fast(er), easy, clear, 1 extra line needed, exported stuff is
evident. Everybody can easily load your module (library) with:
local lib = require "lib"
I believe that's a reasonable "standard". I hope you do not qualify
the two lines involving _M as "reinventing the wheel" :-)
It's easy to add lazily loaded "sub modules" in case one is interested.
KR
- References:
- Re: [ANN] mergelua, Roberto Ierusalimschy
- Re: [ANN] mergelua, Petite Abeille
- Re: [ANN] mergelua, Dirk Laurie
- Re: [ANN] mergelua, Petite Abeille
- Re: [ANN] mergelua, Dirk Laurie
- Re: [ANN] mergelua, Petite Abeille
- Re: [ANN] mergelua, Dirk Laurie
- Re: [ANN] mergelua, Roberto Ierusalimschy
- Re: [ANN] mergelua, Petite Abeille
- Re: [ANN] mergelua, David Manura
- Re: [ANN] mergelua, Mike Pall
- Re: [ANN] mergelua, Petite Abeille