I have a problem with a custom registered type :
Level (7, 2) : INFO : Compiling void start()Level (9, 9) : ERR : There is no copy operator for this type available.
Here is my script :
PhysicsObject@ heart = null; void start() { heart = Level.getObject("i2"); }
Here is the registration of the types in my C++ application :
// Level r = engine->RegisterObjectType("LevelType", 0, asOBJ_REF | asOBJ_NOHANDLE); assert(r >= 0); r = engine->RegisterObjectMethod("LevelType", "PhysicsObject@ getObject(const string ∈)", asMETHOD(Level, getObject), asCALL_THISCALL); assert(r >= 0); // Singleton Script::engine()->RegisterGlobalFunction("LevelType& get_Level()", asFUNCTION(Level::instance), asCALL_CDECL);
// PhysicsObject r = engine->RegisterObjectType("PhysicsObject", 0, asOBJ_REF); assert(r >= 0); r = engine->RegisterObjectBehaviour("PhysicsObject", asBEHAVE_ADDREF, "void f()", asMETHOD(PhysicsObject, addRef), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectBehaviour("PhysicsObject", asBEHAVE_RELEASE, "void f()", asMETHOD(PhysicsObject, release), asCALL_THISCALL); assert(r >= 0); // ... Properties
I call addRef in getObject before returning the PhysicsObject pointer.
I don't know why it does that because I thought handles were references to objects, why do I need to a copy operator to copy the handle?
Thanks, Remi Gillig.