lua-users home
lua-l archive

Re: Working with table from C++

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


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

AltStyle によって変換されたページ (->オリジナル) /