[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: getting upvalues in current thread's environment?
- From: Javier Guerra <javier@...>
- Date: Thu, 11 Jan 2007 18:29:24 -0500
On Thursday 11 January 2007 6:18 pm, Rici Lake wrote:
> > ... 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
to see why this is so difficult: 'global' variables are just entries in a
table: the 'global' table, or more specifically, the environment
table. 'local' variables, OTOH, are stack slots, the compiler strips away
the name, so that using them doesn't require a table access (that makes them
a bit faster).
the debug library crawls the stack and uses some extra hints the compiler puts
in the code; but if it's stripped, there's no such info, and the local
variables doesn't have a name anymore.
Description: PGP signature