[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Locals in Lua Environments
- From: Stefan Brantschen <sbr@...>
- Date: Tue, 29 May 2007 06:52:15 +0200
On 29 May 2007, at 00:21, Tim Hunter wrote:
Under the risk of sounding stupid, just a curiosity: is there any
reason I should not be able to access the function arguments when
I access the function environment via getfenv() ?
My guess would be that this is some colateral effect of the
paremeters being local.
I have no doubt that the argument variables should be local - so
they won't collide with global environment. But when I am
accessing my caller's environment from another function, the lack
of access to his arguments looks kinda strange to me.
I'm using the debug library to do this. debug.getlocal(2,2) gets me
the 2nd argument to the caller, for example.
But note that this is not recommended as "usual programming tool", ie
for anything else but debugging and such.
=> <http://www.lua.org/manual/5.1/manual.html#5.9>
=> PIL II chapter 23
With regards
-- Stefan