lua-users home
lua-l archive

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


Hi,

If you want to get a value from the global table you do:

  lua_gettable(lua, LUA_GLOBALSINDEX);

as if it were a noraml table the the given index.

If you want to get the table itself:

  lua_pushvalue(lua, LUA_GLOBALSINDEX);

and that pushes the global table on the stack.

Once you have the global table on the stack you can also do:

  lua_gettable(lua, -1);

to obtain a value from that table, but that has no benefit over the first
option.

It seems that you want to do something else. Maybe you want to obtain a
reference to the table?


Ignacio Castaño
castanyo@yahoo.es


___________________________________________________
Yahoo! Móviles
Personaliza tu móvil con tu logo y melodía favorito 
en http://moviles.yahoo.es