lua-users home
lua-l archive

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


On Jan 24, 2010, at 5:46 PM, David Burgess wrote:

> On 25/1/2010 12:28 PM, Mark Hamburg wrote:
> 
>> 	function pushenv( newenv )
>> 		local oldenv = getfenv( 1 ) -- However one gains access to it...
> 
> POUNCE.  Methinks that the indoend thing would aided by a currentenv() function.

Well, yes. I was just avoiding introducing a new introspection mechanism. On the other hand, I got the stack index wrong. It should be getfenv( 2 ). This may reflect the fact that under Lua's current environment policy the environment of your caller is frequently more interesting than your environment.

Mark