• Create Account

### #ActualAndreas Jonsson

Posted 13 May 2013 - 05:50 PM

For asOBJ_REF you'll use the asBEHAVE_FACTORY instead of asBEHAVE_CONSTRUCT. The copy constructor should thus be registered as a asBEHAVE_FACTORY function that takes as input the reference to the object that should be copied, e.g.

engine->RegisterObjectBehaviour("image", asBEHAVE_FACTORY, "image @f(const image &in)", asFUNCTION(ImageCopyFactory), asCALL_CDECL);


Did you mean that the engine appeared to enter an infinite loop when you tried to compile a script with img.Copy(@img) and you had registered the function as Copy(const image @&in)? While there is no reason to register the method with this signature (it matches Copy(const image **) in C++), it definitely shouldn't cause a problem. I'll need to look into that, as it would appear to be a bug. That it returned after 7 seconds is probably that the library ran out of memory, as there is no built-in timeout in the library.

If you like the speed of AngelScript, you'll need to try it with the JIT compiler from BlindMind once you've gotten everything up an running. You're likely to see a very good boost in performance with that.

### #1Andreas Jonsson

Posted 13 May 2013 - 05:01 PM

For asOBJ_REF you'll use the asBEHAVE_FACTORY instead of asBEHAVE_CONSTRUCT. The copy constructor should thus be registered as a asBEHAVE_FACTORY function that takes as input the reference to the object that should be copied, e.g. engine->RegisterObjectBehaviour("image", asBEHAVE_FACTORY, "image @f(const image &in)", asFUNCTION(ImageCopyFactory), asCALL_CDECL);

PARTNERS