🎉 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!

vector/array solution

Started by
4 comments, last by Rain Dog 18 years, 4 months ago
I've discovered that it can be quite confusing for users to determine which objects are angelscript built in arrays and which are app registered vectors using the [] operator. Without perfect documentation, a user has to know if MyObj[] implements vector or the AS array interface by trial and error.
Advertisement
Yes, they do. And?
From the app writer's point of view:

Since you're the one that registered the MyObj[] in the first place you ought to know that. However, I intend to add ways to obtain more information from a type id. One of those informations would be if the type is an application registered type or a built in script type.

From the script writer's point of view:

Try to make sure to register the application register vectors to work just like the built in arrays, i.e. support object handles, and have both the length() and resize() methods. That way the script writer doesn't have to know the difference.

Or did you have another solution in mind?

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

I was thinking of the ability to be able to override the built in array object
Well, that's what's causing the problem in the first place, isn't it?

If you want to make the built in array object more like your application registered arrays, then you could probably modify the as_arrayobject.cpp file.

Allowing the application to register a class that completely replaces the built-in array object would be extremely difficult at this moment. The built-in array object relies on run-time type info to be able to do what C++ normally does with templates. Since templates rely on compile time type info, this cannot be used for the generic array object.

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

I was looking at the built in array object and had also come to the same conclusion, that it would be difficult to replcae the built in array type.

I think the best solution is for me to just add a few static functions and change the way the default array is registered.

Just makes it a little bit of a pain during upgrade time =)

This topic is closed to new replies.

Advertisement