Collections of AS Objects only
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.
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.
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.
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
Popular Topics
Advertisement