lua-users home
lua-l archive

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


On 2012-04-01 16:29, Javier Guerra Giraldez wrote:
On Sun, Apr 1, 2012 at 9:23 AM, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
I still have to do the switch, but I think I'm gonna try the portable
approach for 5.2 evolution, ie. write 5.1 and 5.2 compatible modules,
that simply return a table, rather than using the module function.
same here.   i had _never_ willingly used package.seeall, and slowly
came to see that the rest of the module function is almost as dirty
inside, so i had already started to simply return a table on my
modules.


Agree. Better leave to the module user to decide whether to inject the module contents into the global environment. 

So for the small ad hoc scripts and interactive use, it is nice to have an 'import' statement like in Microlight [1] for convenient access to the module. But for serious programming, I prefer 'require' to just return a table.

[1] https://github.com/stevedonovan/Microlight

Egil