lua-users home
lua-l archive

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


On Thu, Oct 20, 2011 at 10:37 PM, Hisham <hisham.hm@gmail.com> wrote:
> With the module() + package.seebase variation suggested at [1] I think
> the only remaining drawback would be that all accesses to globals go
> all the time through function calls when using package.seebase.

That's why my solution suggested that the environment has a straight
__index=lua_libs, and the actual module is a copy of the environment
(whether constructed implicitly through __newindex or explicitly
through a table copy).

So, yes, there's still a little indirection, but not involving a function call.

It's true that _any_ module gets a fresh environment, although this
might be seen as a feature (strictly reducing use of global namespace)

steve d.