lua-users home
lua-l archive

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


On Mon, Sep 26, 2011 at 4:33 PM, liam mail <liam.list@googlemail.com> wrote:
> unless I am misunderstanding something and there are no global lookups
> so to speak anymore (ie GETGLOBAL vm instructions now use a new
> instruction GET/SETTABUP),

This is true, but _in effect_ the _ENV mechanism gives you globals. As
I understand it, if a variable cannot be resolved to a local then it's
assumed to be a lookup on the upvalue _ENV.  (_G remains but isn't
special)

I still think it's useful to have a mode where uncontrolled global
access is verboten and a compile-time error.  The current workarounds
are not so elegant, often involving a custom build step that e.g. for
Lua 5.1 checks out any GETGLOBAL instructions.

steve d.