lua-users home
lua-l archive

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


> Also, getfenv(0) and sefenv(0, ...) can access the current thread's
> environment (which means that there is the potential for plain Lua
> code to be affected).

Actually, getfenv and setfenv will be deprecated too. (But is is easy
to have them back for compatibility.)

Lua 5.2 will have "lexical environments", a kind of lexical setfenv.
The construction "in t do command end"  will execute <command> with
all global variables being resolved in <t>.

Modules can be written as "in module(...) do <body> end", with the
module function returning the module table.

lua_getfenv and lua_setfenv will continue, as debug.setfenv and
debug.getfenv.

-- Roberto