[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: stack level parameter
- From: Doug Currie <doug.currie@...>
- Date: Thu, 21 Jan 2010 11:55:20 -0500
On Jan 21, 2010, at 7:21 AM, David Given wrote:
> [...] pushenv() would be implemented like this:
>
> function pushenv(env)
> local newenv = {}
> setmetatable(newenv, { __index = env })
> return newenv
> end
Earlier I had assumed you meant
function pushenv(env)
setmetatable(env, { __index = <<some magic to do getenv()>> })
return env
end
Otherwise you'd need a way to get the current environment in cases where you just want to make some local dynamic bindings that you want unwound, for example,
in pushenv {print_level = WARNINGS} do ... end
-- e