lua-users home
lua-l archive

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


On Wed, 2003-10-15 at 04:22, Leandro Candido wrote:
>     How can I access a global variable after a redeclaration as a local? Ex:
>             [global x] = -x -- global x = negative of local x

If you *definitely* mean global rather than "local in enclosing scope"
then...

_G["x"] or just _G.x should do what you want (unless I'm horribly
mistaken)

D.

-- 
Daniel Silverstone                       http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org       KeyId: 20687895