lua-users home
lua-l archive

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


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.

-- 
Javier

Attachment: pgpe3aKX3Wl8M.pgp
Description: PGP signature