-
Notifications
You must be signed in to change notification settings - Fork 20
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
Passing a table from C++ to Lua #75
Comments
Hmm. There is no api currently to take a container and convert it to a lua table. I've thought about this a little, and i can go two ways.. Either just auto-wrap std containers directly, or have stack functions automatically take the container and turn it into a table... Wrapping the containers would make it so you can actually change the container directly in lua, not wrapping would mean you can't change the container, but it might be faster to access the data in lua because it doesn't have to bother with metatables and metamethods. |
Both ways are interesting, the latter one would work with my case. |
Both ways are more or less equivalent if all you want to do is pass a stl container into lua as a table. The first would be implemented as a userdata object implementing the __(new)index metamethods. The second would just create a table and populate it with the items from the stl container. As for a lua table wrapper, there is already a class (LuaGlueLuaTable) that could be extended to support that. And I might at some point. Right now it only exists to support passing tables back into C++ from lua. |
Hello,
Is there currently any way to create a table in C++ and pass it to a Lua function?
I'm actually trying to convert a std::vector (or a std::list) so I can pass it to my Lua function
Thanks
The text was updated successfully, but these errors were encountered: