lua-users home
lua-l archive

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


On Tue, Apr 9, 2013 at 4:58 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2013/4/9 steve donovan <steve.j.donovan@gmail.com>:
Your first upvalue is the current global table, unless you don't need it.
A name is reserved for it. Crystal-clear logic.

It might not be the first upvalue, depends whether a 'global' is referenced first before any other upvalues.

That's fine, always thought that function environments were _hard to explain_. (great way to evaluate a feature)

It's just that assigning _ENV to something else strikes me as magicky as module()
 

Being someone whose first language never was Lua 5.1 (I converted to
Luanity in November 2011, when 5.2 was already beta), I've never written
any Lua code that calls setfenv/getfenv. They feel like curious kludges
to me :-)