Re: getting upvalues in current thread's environment?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: getting upvalues in current thread's environment?
- From: Rici Lake <lua@...>
- Date: 2007年1月11日 18:18:27 -0500
On 11-Jan-07, at 6:14 PM, Matthew Armstrong wrote:
Is it possible to get an environment with local variables present too?
I'm trying:
function flarp()
local myLocal = "hello"
local myEnv = getfenv()
print(myEnv.myLocal) -- (prints nil)
end
flarp()
... but myEnv.myLocal is still nil. Anyone know a way of doing this?
Or is it impossible?
You can only do it with the debug library, which is not recommended for
production code (as well as being quite slow, and somewhat unreliable
since it won't work if the compiled code has been stripped.)