|
Already solved. See http://lua-users.org/lists/lua-l/2016-05/msg00187.html , also the discussion over the previous week. This doesn't work in global scope, only in function scope, but it allows you to control the accessibility of globals *and* upvalues (which has largely been missing from this discussion) and generates compile time errors if an unknown variable is accessed. The syntax can only work at a scope change because of the way the compiler works, so in some cases you may need an extra closure to get the behaviour you want. I've been running this in all of my Lua code for 2 1/2 years now. Regards, Duane. |