[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to print the content of Table/
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 7 May 2012 09:34:15 +0200
On Mon, May 7, 2012 at 9:23 AM, Miles Bader <firstname.lastname@example.org> wrote:
> E.g. a common use is to list all global variables:
> for k,v in pairs(_G) do print (k, v) end
Or to make new global variables:
key = 'dog'
_G[key] = 'barney'
There's nothing magic about _G; the magic is that the 'global
environment' is _just a table_, and _G is a variable referencing it.
(_ENV is more subtle, since _setting it_ is meaningful)