Sign in to follow this  
ninvertigo

Am I missing something? Lists/collections help

Recommended Posts

ninvertigo    127
I have a generic class created in angel script that the application is agnostic of. My questions is how exactly is the script writer to keep track of the objects he/she creates? I tried registering the built-in array class and creating an array of @class pointers as the data type without success. After a couple hours of research I found what appeared to be a vector addon for ascript, but this is still dependent on the application registering the vector types. Are there any collections like std::list available for the script to use independently of the application? Worst case, even having access to malloc and being able to store the class pointer in script would be fine.

Thanks,
-Vert

Share this post


Link to post
Share on other sites
WitchLord    4677
The [url="http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_array.html"]script array add-on[/url] is agnostic to the type of the elements.

The application needs to register it with the script engine with a call to RegisterScriptArray(engine), then the scripts can can create arrays of any types it like:

[code]
// script
class MyClass { }
array<MyClass@> arrayOfHandlesToMyClass;
array<int> arrayOfInts;
[/code]

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