lua-users home
lua-l archive

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


2013/11/22 Craig Barnes <craigbarnes85@gmail.com>:
> On 22 November 2013 03:43, Andrew Starks <andrew.starks@trms.com> wrote:
>> If you're redistributing the module, a table is expect, which feels more sorted out.
>
> If a module only provides a single, top-level function, feeling
> "sorted out" isn't a particularly compelling reason to avoid just
> returning it as-is.

Lua standalone is my favourite interactive language, so I like modules
that print
something informative when you require them. I like them callable too: function,
callable table or userdata, it does not matter.

E.g.

> mymod = require "mymod" -- prints a welcome message

If for non-interactive use you want to suppress the message, that
can be done by providing an option, e.g.

> mymod = require "mymod" "silently"