Re: patch for direct access to STL containers from lua
Thomas Nelson <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
I will take a look at your code this weekend. I recently started a new job and that is eating a good deal of the time I had been spending on my game project (and even in my game project I've had to switch over to network coding mode and away from the script side) Off the top of my head from your points: - Speed wise, vector and map should be fine, std::lists however are more problematic. I included them mostly as a proof of concept. A list does not allow for random access to its elements which means the only way to access the Nth element is to get the iterator from begin() and increment it N times. I should be roundly flogged for writing that code even as a PoC. My std::set implementation has the same issue. -- Possible solutions: maintain a cursor or "current" iterator and adjust that with each access. - Removing an element by assigning nil. I'll have to refresh my memory but I'm not sure that is possible. I would recommend that you use shared pointers in your container to simulate this (and check for null on the C++ side). - What method are you using to create your multiple states? TomN On 6/15/2010 5:33 AM, Christophe Juniet wrote: > Hi Thomas, > > First of all, thank you for your excellent work! > This is exactly what I was trying to achieve, except for a few things: > - I need read/write access, mostly to vector, list and map. > - I need to remove an element, by assigning nil to it for instance. > - I must use multiple Lua states, most likely through different threads. > > I've tried to modify your patch to address these points and I would be > very thankful if you could have a look at it. > Maybe you have already worked on these issues, in which case I would > be very interested to follow your progress and help you in any way. > > > Best Regards, > Christophe > > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > > > _______________________________________________ > luabind-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/luabind-user > ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user