Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ iterators for Lua tables #72

Open
thinlizzy opened this issue Feb 15, 2016 · 5 comments
Open

C++ iterators for Lua tables #72

thinlizzy opened this issue Feb 15, 2016 · 5 comments

Comments

@thinlizzy
Copy link

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

@ThePhD
Copy link
Contributor

ThePhD commented Feb 15, 2016

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
Copy link
Author

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

On Sun, Feb 14, 2016 at 7:57 PM, The Phantom Derpstorm <
[email protected]> wrote:

Try using

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


Reply to this email directly or view it on GitHub
#72 (comment).

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
Copy link
Contributor

ThePhD commented Feb 15, 2016

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
Copy link
Author

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
Copy link
Contributor

ThePhD commented Mar 27, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants