Jump to content
  • Advertisement
Sign in to follow this  
JoshKlint_34394

ToLua++, vectors, and lists

This topic is 2612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does ToLua++ support std::vectors and lists, so I can do stuff like this?:

C++:
class Entity
{
std::list<Entity*> kids
};

Lua:
local child
for child in entity.kids do
--do stuff
end

Share this post


Link to post
Share on other sites
Advertisement
It's quite a workaround, but there appears to be a way to do this here:
http://stackoverflow.com/questions/837772/how-do-i-pass-a-list-of-objects-from-c-to-lua

Share this post


Link to post
Share on other sites
What is the reason you want to make a copy of the std container in Lua? Is the boundary jumping causing a problem when you implement a Lua iterator for the container?

Share this post


Link to post
Share on other sites
I haven't looked that closely at it yet, actually, I just came across a page that claims to have a solution. I don't know how to make a Lua iterator for a container yet, but that would certainly be preferable.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!