Rapptz / sol

A C++11 Lua wrapper
MIT License
209 stars 32 forks source link

C++ iterators for Lua tables #72

Open thinlizzy opened 8 years ago

thinlizzy commented 8 years ago

Any plans on adding iteration capabilities in sol::table ?

ThePhD commented 8 years ago

Try using

sol::table t = ...;
t.for_each( /* function that takes key, value */ ) ;

Note that this is only present in the develop branch of sol.

thinlizzy commented 8 years ago

error: 'class sol::table' has no member named 'for_each'

On Sun, Feb 14, 2016 at 7:57 PM, The Phantom Derpstorm < notifications@github.com> wrote:

Try using

sol::table t = ...; t.for_each( /* function that takes key, value */ ) ;

— Reply to this email directly or view it on GitHub https://github.com/Rapptz/sol/issues/72#issuecomment-184015985.

https://github.com/thinlizzy/ http://die-xml.googlecode.com/ - C++11 and C++14 open source wrappers and libraries for various purposes (XML, image, webserver... and even a MTG implementation) http://baudejogos.net - o único site brasileiro decente de jogos

ThePhD commented 8 years ago

Please pull from the develop branch of Rapptz/sol (you're currently using the master branch) to get more updated features, or use the experimental version 2 of the library here.

thinlizzy commented 8 years ago

Hi! Does the develop branch also support checking if a table key exists?

I've seen sol2 has sol::optional, which also works for me. Perhaps I should early migrate to sol2, instead of trying the develop branch?

ThePhD commented 8 years ago

Yes. sol2 is no longer experimental and has support for the features you're looking for.