lua-users home
lua-l archive

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

On Tue, Oct 5, 2010 at 3:50 PM, Matthew Wild <> wrote:

What do you call the "better alternative"? Your original email gave a
very good example of the problems with require/module() in 5.1. A
module that simply returns its module table (not the magic version I
gave above, but the one Steve did) would work as-is in both 5.1 and
5.2. It also doesn't pollute the global namespace, something most
people regard as bad practice (which is why module() has been
deprecated, since it encourages this).

By better alternative I meant that I didn't see how your example with returning a function is a step forward style-wise compared to module(). Steve's example is clean and simple, so that was the kind of example I was hoping for. I understand that returning a table solves the problems with module. Sorry if I'm lagging a bit behind in my replies...