lua-users home
lua-l archive

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


Daurn and Serguey,  Thanks a lot for

  local _ENV = setmetatable({},{__index=_G})
and (probably even better)
  local _ENV = setmetatable({},{__index=_ENV})

It may be the easiest way to adapt existing modules.
One should also replace:
  require 'my_module'
with
  local my_module = require 'my_module'

If I understand correctly what Roberto said ("We are changing the
policy that modules should define globals."),  it would be even more
useful to have some syntactic sugar for precisely this.  Eg.:

  import my_module

for

  local my_module = require 'my_module'

I know this has already been proposed and discussed on the list, but
given this new module policy, wouldn't it make even more sense?

Phil