how to get the table from the stack

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get the table from the stack

Honglei Tu
hi,
I am a new programmer in Lua.
If I use C code to push a table
on the top of stack.
In Lua code, how to get the table.
I know if I call a Lua function
such as f(a), the a will be the table.
But If I just want to use normal Lua code,
is there any functions to get the table?
Thank you very much for any info.
Honglei

Reply | Threaded
Open this post in threaded view
|

Re: how to get the table from the stack

Luiz Henrique de Figueiredo
>If I use C code to push a table
>on the top of stack.
>In Lua code, how to get the table.
>I know if I call a Lua function
>such as f(a), the a will be the table.
>But If I just want to use normal Lua code,
>is there any functions to get the table?

You must either set the table as the value of a global variable or of a table
field, or you must send it as one of the return values of a function that was
called from Lua.  See the implementation of the standard libraries for code
that send values to Lua.
--lhf