lua-users home
lua-l archive

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


Hi,

There are two issues here. One is namespace polution. The
other is returning the namespace from require().

In most cases, require *will* return the namespace. Either
your package returns it directly, or it calls module()
(which sets the package.loaded table) and returns nil. In
either case, the namespace will be returned.

About the namespace problem, Mildred's solution does the
trick. If you don't want your module to polute the
namespace, set loaded[modname] to the namespace *before*
calling module().

Regards,
Diego.