Re: Working with table from C++
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Working with table from C++
- From: David Haley <dchaley@...>
- Date: 2008年4月08日 21:22:05 -0700
Hi,
On this day of 04/08/2008 06:31 PM, Eugen-Andrei Gavriloaie saw fit to
scribe:
> It might sound stupid, but it seems that I can't find a way to iterate
> through a table in c++. Suppose we have a table pushed onto the stack
> (lua calls a c++ function and passes all the parameters using a table:
> key/value pairs). How do I iterate on that table (present on the top
> of stack) in c++? I need both elements (key and value).
Here's the manual section you want:
http://www.lua.org/manual/5.1/manual.html#lua_next
It describes the table traversal succinctly and mentions a caveat about
converting keys to strings that you should know about.
Cheers,
- David
--
~David-Haley
http://david.the-haleys.org