lua-users home
lua-l archive

Re: How to enumerate a Lua table in C++?

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


Quoth Gopalakrishnan Subramani <gopalakrishnan.subramani@gmail.com>, on 2010年11月25日 16:35:22 +0530:
> I am trying to create a prototype, in that we have a Lua table and we want
> to enumerate the elements of the lua table in C++ and print them.
> 
> How to enumerate a lua table in C++? To get the lua table, we call a lua
> function in C++ and that lua function returns the lua table.
> 
> Any source code example would be appreciated.
Use lua_next, which is described quite well in the C API
documentation. Start with a nil key, then keep retrieving the next
element from the table until you get another nil back which means
you're done.
 ---> Drake Wilson

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