[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Get environment of a function
- From: PA <petite.abeille@...>
- Date: Fri, 17 Mar 2006 17:53:54 +0100
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/