[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A review of changes between 5.1 and 5.2-work3
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 20 May 2010 13:42:26 -0300
> No more "in env do ... end". So what's now the preferred idiom for
> executing a given function in different environments?
>
> (passing the desired environment as an argument and setting_ENV at the
> beginning of the called function?)
You could write your function to be run in different environments:
function f(_ENV,...)
... -- code that never even mentions _ENV!
end
Or you could provide a setter:
do
local _ENV=_ENV
function setenv_for_f(env)
_ENV=env
end
function f(...)
...
end
end