lua-users home
lua-l archive

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


Gunnar Zötl:
> So if I understood it correctly, not only can
> every function have its own "global" table, but it is indeed the case
> that each function has a reference to a global table, which, in the
> default case, is the top level global table.

Peter Hill:
> Yes... in a variable named "_G".
>
> So:
>   xyzzy = 123
> and
>   _G.xyzzy = 123
>
> are the same thing.

Whoops. Sorry. "_G" doesn't seem to behave quite the way I thought it did.
Worse, I can't find any reference to it in the Lua5b manual (I must have
been getting all my info on it from the list!).

So can someone who knows please tell me how to change the general table of
globals in Lua5 and what is _G's usage?

*appologetically*
Peter Hill.