Sign in to follow this  

A question about AngelScript

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

This topic is 4589 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this