lua-users home
lua-l archive

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


On Tue, 19 Jan 2010, Mark Hamburg wrote:

> This approach does not introduce a stack of environments akin to the 
> PostScript dictionary stack. One could build such a stack via 
> appropriately constructed environments:
> 
> 	in _G:pushenv( env ) do ... end
[snip]
> But that's a construct built on top of the basic mechanisms.

You left out the stack unwinding with popenv().  Of course you need to 
pop it on errors as well, so every pushenv() ought to be called inside 
a pcall().  The required error handling makes your approach less 
appealing than what your example might suggest.

Cheers,

Joonas