AngelScript 2.6.0 WIP 4

Started by
5 comments, last by ViTo 18 years ago
I've uploaded the third WIP to the site. I've modified the implementation of the methods to get and set arguments to the script functions, i.e on the asIScriptContext and asIScriptGeneric. This was done to be more consistent when working with parameter references and objects. If you're using these methods, it is possible they start to fail if you update to this version. If that happens you should try switching to one of the other methods, for example SetArgAddress() instead of SetArgObject(), and vice versa. Generally speaking you should use the method that best matches how the parameter was registered, i.e. SetArgAddress() for parameter references, and SetArgObject() for objects and object handles. I've also spent a lot of time on making the library compatible with 64bit CPUs. There is still no support for native calling conventions on 64bit CPUs, but you should be able to use the library anyway by declaring the flag AS_64BIT_PTR when compiling the library. What this does is to change how pointers are stored in the compiled bytecode. There is likely some things that still don't work on 64bit processors so I need your help to test the library. Hopefully there should only be a few things though. Regards, Andreas [edit]2006-03-30: Uploaded WIP 4[/edit] [Edited by - WitchLord on March 30, 2006 8:02:50 PM]

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

Advertisement
I've got a problem in that I can no longer register a function like this:

r=ASWrapper->ScriptEngine->RegisterGlobalFunction("float Modf(float x, float &inout)" ,asFUNCTIONPR(modf,(float, float*),float) , asCALL_CDECL); assert(r >=0 );


This is using 2.6.0 WIP3.

It used to work for 2.5.0c.

Indeed, you cannot.

What you can do however, is to compile the library with AS_ALLOW_UNSAFE_REFERENCES, and then register the function with:

r=ASWrapper->ScriptEngine->RegisterGlobalFunction("float Modf(float x, float&)" ,asFUNCTIONPR(modf,(float, float*),float) , asCALL_CDECL); assert(r >=0 );


Only object types that support object handles allow the use of &inout now (except when unsafe references are allowed). I had to do this in order to keep the script language consistent and avoid confusion for the script writers.

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

I've just uploaded WIP 4 of version 2.6.0. Now the first script
classes are complete. You can declare classes in the scripts with
methods, properties, and constructors to initialize them. The
application can create the classes and call the members as well as
access the properties.

This version is feature complete, so if you intend to upgrade to 2.6.0
you might as well give yourself a headstart and help me test it in the
process.

The next step is to implement interfaces for polymorphism, and single
inheritance for reusing implementations. I decided to a similar
solution to OO that Java uses, as the C++ is way too complicated and
doesn't work well with the way the script functions. The interfaces
should serve well for any polymorphism needs, and the single
inheritance should be sufficient for most cases where inheritance is
wanted.

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 Andreas,
I've got a problem.
I would like to call class method with argument from C/C++ code.

int methodId = engine->GetMethodIDByDecl(0, "myclass", "void method2( float a )");if( methodId < 0 ) 	fail = true;else{	asIScriptContext *ctx = engine->CreateContext();	ctx->Prepare(methodId);	ctx->SetObject(s);	ctx->SetArgFloat( 0, 1.0f );	int r = ctx->Execute();	if( r != asEXECUTION_FINISHED )		fail = true;	if( !v || *v != 3 ) fail = true;	ctx->Release();}


I had error during ctx->Release() execution:
"HEAP CORRUPTION DETECTED after Normal block...."

How to call method with argument ?

/ViTo
http://vito.nilaya-games.com
Sebastian Kowalczyk / ViToPeople Can Flyhttp://www.skowalczyk.com
Hi ViTo,

You're doing it correctly. However you stumbled upon a bug that I fixed yesterday. I just released the final 2.6.0 version, if you download that it should work just fine.

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

Cool, you read in my mind :D
Thanks a lot.

/ViTo
http://vito.nilaya-games.com
Sebastian Kowalczyk / ViToPeople Can Flyhttp://www.skowalczyk.com

This topic is closed to new replies.

Advertisement