Jump to content
  • Advertisement
Sign in to follow this  
Assidragon

A question about AngelScript

This topic is 4830 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

Heya :) First of all, nice engine you have here. Congrats. ^_^ A few words why am I here... after having realized I need to overhaul my scripting engine (I ended up with a totally messy syntax lol) I was wondering wheter to simply just throw it out and use something already up to the job. So I got to Angelscript and very liked some of the features (especially the fact I don't have to mess around with proxy functions). Now my question might be totally stupid for seasoned AS users, if so, sorry about in advance. How does AS stand with stl containers? My code makes pretty heavy use of them (namely, of std::vector, std::string, std::map, stdext::hash_map, std::multimap and std::deque), so it's pretty important to nicely handle them. Now, I have alredy seen the std::vector implementation class for AS, so I figure at least that one works =) but I wondered what about the rest - I mean, I would have to make wrappers for those, or is there some way to handle them more lazyly?

Share this post


Link to post
Share on other sites
Advertisement
The STL containers doesn't have a native reference counter, so they are not ideal for AngelScript. But with a little work (and I mean a little) you should be able to get them to work just fine.

I suggest you take a look at how asCScriptString (in add_on/scriptstring) is implemented. This is a very light wrapper on the std::string class that adds reference counting so that object handles can be used with the string type. Only very few of the std::string methods needs to be wrapped.

It might even be possible to use shared_ptr<> or something similar as the wrapper of the STL container.

Of course, if you don't want the containers to support object handles, then you could register them just like the code in stdvector.h does it. It wouldn't be very effective though, as objects without support for handles are copied a lot when passed around.

Regards,
Andreas

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!