lua-users home
lua-l archive

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

On Wed, Feb 24, 2010 at 9:25 PM, Geoff Leyland
<> wrote:
> How does strict work with modules?
> As far as I can tell, strict.lua (pl's and lua's) both change the metatable of _G.  But inside a module the global environment is _M.  How is _M affected by what you did to _G?

Modules aren't affected currently, although the same principles should
apply. In any large application, most of the code is in modules
anyway, so use of unassigned module scope variables is just as much a

strict.lua had to fool with _G's __index; pl.strict.lua does so via
setting a handler on the load-by-demand global __index;  _M already
has an __index (often pointing at _G) so I'd have to be careful.

steve d.