🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

REF_CAST

Started by
3 comments, last by Pris 16 years, 1 month ago
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
Advertisement
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Hello,


Ok. Thanks you for reply. I'll be wating for this feature.

Hi Pris,

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Hello,


Thank you for so quick feature implementation. I try it very soon and give you a reply.

//EDIT

I've updated script engine to new version. Implemented REF_CAST and what I could say, it's working :). Thanks a lot.

[Edited by - Pris on May 26, 2008 8:57:49 AM]

This topic is closed to new replies.

Advertisement