[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to print the content of Table/
- From: Miles Bader <miles@...>
- Date: Mon, 07 May 2012 16:23:25 +0900
Emeka <emekamicro@gmail.com> writes:
> A global variable (not a function) that holds the global environment (see
> §2.2 <http://www.lua.org/manual/5.2/manual.html#2.2>). Lua itself does not
> use this variable; changing its value does not affect any environment, nor
> vice-versa.
>
> The above is still confusing, what is it used for? And why is it there at
> all?
It's for your convenience (as a Lua programmer) ... just in case you
wanna see what's in the standard global environment (in convenient
table form).
E.g. a common use is to list all global variables:
for k,v in pairs(_G) do print (k, v) end
-Miles
--
Saa, shall we dance? (from a dance-class advertisement)