🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A question about AngelScript

Started by
0 comments, last by WitchLord 19 years, 1 month ago
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?
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement