[angelscript] AngelScript 1.6.1 beta 4 (+forum)

  • From: "Andreas Jonsson" <angelcode@xxxxxxx>
  • To: angelscript@xxxxxxxxxxxxx
  • Date: Tue, 09 Mar 2004 17:20:17 +0000

Dear subscribers,

The 4th beta has now been released. The novelty in this version is that it =
supports operator overloads, at least partly. All binary operators (excep=
t compound assignment operators) can be overloaded. The other operators w=
ill be supported in the next beta version. I have to cleanup the code I j=
ust wrote to add the operators, there are quite a lot of it that can be r=
eused for the other operators and also for function overloading.

The operator overloads are registered with the RegisterTypeBehaviour() meth=
od. And should be done as follows:

engine->RegisterTypeBehaviour(0, asBEHAVE_ADD, "bstr f(const bstr&, const b=
str&)", asFUNCTION(asBStrCopy), asCALL_CDECL | asCALL_RETURNBYVAL);

The first parameter which defines the datatype should be set to zero, which=
 means that the operator is global.

The second parameter can be any of the asBEHAVE constants declared in angel=
script.h.

The third parameter declares the parameter types and return type for the op=
erator. At least one of the parameter types must be a registered type. Th=
e return type cannot be used as differentiating factor for overloads. The=
 parameter types should preferably be references when dealing with regist=
ered type and non-references when dealing with primitive types as that is=
 the most efficient (from the engine's point of view).

The fourth parameter is the pointer to the C++ function. Use the macro asFU=
NCTION() to convert it to a (void *).

The fifth and last parameter shows the calling convention used. Here you mu=
st use asCALL_CDECL, and optionally asCALL_RETURNBYREF or asCALL_RETURNBY=
VAL.

Dave at GameDev.net just notified me that he opened the new AngelCode forum=
 (on my requests) so now the best place to ask questions about AngelScrip=
t will be there. The link to the forum is:

http://www.gamedev.net/community/forums/forum.asp?forum_id=3D49

I'll block the mailing list for posts so that it will work only as a news l=
etter from now on. I will continue to answer questions sent to my e-mail,=
 but may redirect some of them to the forum.

Thanks for all the feedback I've received these last weeks. It is greatly i=
nspiring and I now have a large list of "to-do"s in front of me. The firs=
t one will be to complete the operator overloads (and perhaps function ov=
erloads as a side effect). Another that has been requested will be to add=
 a method for evaluating a single script string using already compiled sc=
ript code. This would be highly valuable for those that are using AngelSc=
ript to execute console commands (ala Quake). More will come as I decide =
what to do first.

Regards,
Andreas Jonsson
Author of AngelScript
www.AngelCode.com



AngelScript - AngelCode Scripting Library
http://www.angelcode.com/angelscript/

Other related posts:

  • » [angelscript] AngelScript 1.6.1 beta 4 (+forum)