lua-users home
lua-l archive

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

On Thu, Nov 21, 2013 at 5:20 PM, Petite Abeille <> wrote:

On Nov 21, 2013, at 10:59 PM, Marc Lepage <> wrote:

> Is a module that is a function (not a table) a reasonable thing?

Sure, why not.

> Is it a common idiom (in this case)?


> Are there alternatives?

A callable table, i.e. one with a __call metamethod:

It happens that I'm currently using a callable table, but the one other function I have in the table I'm OK to get rid of. So I can switch it to a function instead of a table. I am sort of asking if that's OK, nothing will break because it's a function instead of a table. I guess I'm good to go?