lua-users home
lua-l archive

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



On Mar 17, 2006, at 16:28, Alexander Gladysh wrote:

But now in_context_of resets environment of passed function to _G. Is
there a way to avoid this?

Hmmm... perhaps by not calling setfenv(func, _G) in the first place?

 The getfenv() works only for current
function. :(

getfenv (f)

Returns the current environment in use by the function. f can be a Lua function or a number that specifies the function at that stack level: Level 1 is the function calling getfenv. If the given function is not a Lua function, or if f is 0, getfenv returns the global environment. The default for f is 1.

http://www.lua.org/manual/5.1/manual.html#pdf-getfenv

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/