lua-users home
lua-l archive

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


> is there any way to make a Lua variable reference another variable?

A Lua global is actually a key in the global environment table. So if _G is
the global environment table (which it is if you haven't changed it with
setfenv and you are using the standalone Lua interpreter) then

  a

is the same as

  _G.a

is the same as

  _G["a"]


Hope that helps


"Milking It", Oxfam's first online resource for secondary schools, is now
live. Find out how Oxfam is encouraging young people to learn about trade
and dumping. http://www.oxfam.org.uk/coolplanet/milkingit

Oxfam works with others to find lasting solutions to poverty and suffering.

Oxfam GB is a member of Oxfam International, a company limited by guarantee and registered in England No. 612172.
Registered office: 274 Banbury Road, Oxford OX2 7DZ.
Registered charity No. 202918.

Visit the web site at http://www.oxfam.org.uk