-
Notifications
You must be signed in to change notification settings - Fork 32
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
sol::table:size() #63
Comments
It's a bug that's been fixed here: #61 (comment) . If you want the fix, pull from the Note that in the develop branch, specifically to get around this problem, we created Also, be careful: the raw length is the number of consecutive integer/number keys. If a table happens to have string keys, that size will only count up to that first string key, and then you'll stop before hitting the rest of the table's keys and values. Finally, if you know for CERTAIN that you'll only have integers for keys, then your table should be just fine; this is just a heads up! Happy coding. |
One final note: the |
Thanks for this quick and extensive response ;) My fault not looking at develop branch, only in the master one. |
Hi
I am very new to github so please forgive my noobness: I started using Sol and managed to integrate it (it's very easy, no problem here) in my test program. I tried the following: load a lua file which has a generateDungeon function which returns a 4096 elements table. Then in C++ I do the following:
Everything works flawlessly but when I want to read all the values from table:
loop finishes but I have seg fault errors in random places. I tested commenting here and there and my conclusion points to sol::table::size(). I took dungeon.size() call out from for loop:
With this change everything works. I checked sol::table:size() and we have the following:
With my total lack of knowledge of how sol and lua work, I would say that push() makes some stack get bigger in each call to size() and finally makes my app crash. Is it possible this to be a bug?
Thanks for your library by the way ;)
Regards
The text was updated successfully, but these errors were encountered: