lua-users home
lua-l archive

Re: Lua registry, environment, and threads.

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


> Also, if you are deprecating setfenv, then it probably makes sense
> to add an optional second parameter to the load routines which would
> provide the environment to associate with the loaded chunk [...]
There is be another function for that, loadin. (Both 'load' and
'loadin' accept the chuck both as a function, as in 5.1, or as a
string.)
> though I guess you could do this with the new construction as:
> 
> 	local f
> 	in environment do f = loadstring( code ) end
That will not work. "in" is lexical, it does not affect dynamic code
(the same way that the dynamic code cannot access local variables).
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /