REF_CAST
Hello,
First, thank you again for such excellent script engine :)
I would like to ask, when you intend to implement support for casting reference types (REF_CAST), I asking about it because i need to plan my work in my job.
Thank you in advance
I've been quite busy the latest weeks, between private life, work, and the BMFont update. But I hope to get more time to work on the next release for AngelScript now.
REF_CAST is on the top of my to-do list and I'll probably implement it very soon (though you'll probably have to give me at least another month or two).
Regards,
Andreas
REF_CAST is on the top of my to-do list and I'll probably implement it very soon (though you'll probably have to give me at least another month or two).
Regards,
Andreas
Hi Pris,
I just checked in the first support for asBEHAVE_REF_CAST in the SVN.
In the script this is used as follows:
Currently the casting can only be done via explicit casts, but later on I'll implement asBEHAVE_REF_CAST_IMPLICIT that will allow the application to tell AngelScript which casts that can be made implicitly, e.g. when casting from derived class to base class.
I just checked in the first support for asBEHAVE_REF_CAST in the SVN.
// Example REF_CAST behaviourB* castAtoB(A* a){ B* b = dynamic_cast<B*>(a); if( b == 0 ) { // Since the cast couldn't be made, we need to release the handle we received a->release(); } return b;}// Example registration of the behaviourr = engine->RegisterGlobalBehaviour(asBEHAVE_REF_CAST, "B@ f(A@)", asFUNCTION(castAToB), asCALL_CDECL); assert( r >= 0 );
In the script this is used as follows:
// AngelScriptA a;B @b = cast<B@>(a);
Currently the casting can only be done via explicit casts, but later on I'll implement asBEHAVE_REF_CAST_IMPLICIT that will allow the application to tell AngelScript which casts that can be made implicitly, e.g. when casting from derived class to base class.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement