• Advertisement
Sign in to follow this  

(closed) Runtime array<T>

This topic is 1634 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The CScriptArray class requires a pointer to asIObjectType upon construction.  The asIObjectType pointer passed into the constructor appears to be the type of the Array itself, not of the array's subtype.  If I only have the subtype and I wish to generate an array of that subtype, how do I generate the appropriate asIObjectType object?

 

In my case I have a registered object, which I will call "MyType".  I want to instantiate an array of type "array<MyType>" at runtime from my C++ code.  "array<MyType>" will most likely not already be registered, so 

engine->GetObjectTypeByName("array<MyType>")

will likely return nullptr.

 

Thanks 

Share this post


Link to post
Share on other sites
Advertisement

I'm sorry, I've realized my error.

 

I needed to call:

engine->GetObjectTypeId(engine->GetTypeIdByDecl("array<MyType>"))

I must have breezed passed that my first read through the documentation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement