lua-users home
lua-l archive

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

On Mon, 5 Feb 2001, Daniel Krenn wrote:

> I had some trouble earlier today trying to get a value from a table
> from C. Is there a simple way to do this (maybe I did something wrong,
> or I've missed something??)

	Let t be the index of the table in the stack. One may write:

lua_pushstring(lua_state, "key");
lua_gettable(lua_state, t);

and then the value will be pushed in the stack.

  --Alex		Lab. de Computação Gráfica/UFC
|"Minha força vem da solidão. Não tenho medo das chuvas tempestuosas nem das |
| grandes ventanias soltas, pois eu também sou o escuro da noite."	     |
|	- Clarice Lispector						     |