Sign in to follow this  
RsblsbShawn

Collections of AS Objects only

Recommended Posts

RsblsbShawn    122
Hey, I'm trying to do something that should be simple, but I can't find out how =( Basically in script I have: Class C { }, I would like to create a vector of C's. I use ASVector to register the types defined in C++, but I can't register types defined in AS only. I need functions like remove and other vector functions. I'd also like a list class, but I can do that after I get vector working. The current implementation of as_arrayobject uses a new'd pointer to hold arrays. If there isn't a built-in solution for what I'm looking for, could it be easily created by modifying as_arrayobject to use a vector instead? Thanks a lot! -Shawn.

Share this post


Link to post
Share on other sites
WitchLord    4678
For you to be able to register a vector class, the application needs compile time knowledge of the type that will be stored in the vector, which unfortunately it doesn't have.

You could potentially register an interface, then register a vector type that holds asIScriptStruct*. But you would have to be careful to take of the reference counting manually.

If you need a specific method for the arrays, then perhaps it would be a better idea to simply modify as_arrayobject.cpp. That way the method will be available for all array types, not just the ones you override.

Share this post


Link to post
Share on other sites

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