lua-users home
lua-l archive

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


> > Yes. We are changing the policy that modules should define globals.  We
> > changed environments. We think now the 'module' function adds too much
> > complication for something that it is easy to do directly.
> 
> How would you do it directly?  Something like this?
> 
>   local _M = []
>   in _M do
>       function globalfunction()
>           -- ...
>       end
>   end
>   return _M

Probably something like this:

 local _ENV={}
 function f1() ... end
 function f2() ... end
 ...
 return _ENV