Advertisement

(closed) Runtime array<T>

Started by August 30, 2013 01:54 PM
0 comments, last by Jason Goepel 11 years, 2 months ago

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

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.

This topic is closed to new replies.

Advertisement