"Type" was an obvious generalization. My real object "SIVar".
The relevant code to register SIVar type is:
r = engine->RegisterObjectType("SIVar", sizeof(int), asOBJ_VALUE | asOBJ_APP_CLASS_CD); assert(r >= 0);
r = engine->RegisterObjectBehaviour("SIVar", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructSIVarDef), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectBehaviour("SIVar", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(DestructSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "const uint32 GetSelector()", asFUNCTION(GetSelectorSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "int opImplConv() const", asFUNCTION(IntConvertSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "uint32 opImplConv() const", asFUNCTION(UIntConvertSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
// r = engine->RegisterObjectMethod("SIVar", "bool opImplConv() const", asFUNCTION(BoolConvertSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "bool b() const", asFUNCTION(BoolConvertSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "int32 opAssign(int32)", asFUNCTION(IntAssignSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
r = engine->RegisterObjectMethod("SIVar", "uint32 opAssign(uint32)", asFUNCTION(UIntAssignSIVar), asCALL_CDECL_OBJLAST); assert(r >= 0);
I have a lot of objects of this type and arrays of them living in an external hardware, and the script is not allowed to create/destroy them but only access reading the value (through the implicit conversions to int and uint and possibly bool, when will be allowed) or writing (through the two opAssign).
After declaring this type, I tried to declare those external object withing the script using the RegisterGlobalProperty.
The actual code that does this, actually read the definitions of the objects from an xml file and builds on the fly the RegisterGlobalProperty parameters, so the real code fragment is useless here. But at the end RegisterGlobalProperty receives a string and a this pointer.
The code is:
r = engine->RegisterGlobalProperty(vDef.c_str(), (void*)VarSelector);
Where the VarSelector is actually a handle to each of the existing external object, and the vDef string contains something like:
"SIVar CurrentWs"
"SIVar UsedWs"
"SIVar SystemStart"
....
Finally I tried to register to the script arrays of such objects, and I tried the strings in the original post (just replace Type with SIVar), getting the described errors.
Thanks for any help.
Mau.