Arrays are broken in new version.
"The application doesn't support the default array type."
the way i am declaring it is like so int[] a; It has been a while since i updated my angelscript version, so maybe some stuff have changed in the past few years since i last updated.
The script array add-on that comes with the sdk is fully compatible with the previously built-in array. You just need to register it with a call to:
RegisterScriptArray(engine, true);
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 have another question, now in this version every time i exit my application it ends abruptly and throws an exception on this function in the file as_scriptengine.cpp. The older version i had was fine.
int asCScriptEngine::CallObjectMethodRetInt(void *obj, int func)
{
asCScriptFunction *s = scriptFunctions[func];
asSSystemFunctionInterface *i = s->sysFuncIntf;
I would need to know more about your implementation to give you a more precise answer. Can you check the name of the function and the object type that the engine is trying to call? The asCScriptFunction object has this information.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
One of the weird things i notice is that when i call engine->CreateContext, it automatically called AddRef and set the reference count to 2 which should be 1. I am not sure if that is the problem but you can try looking into it.
I'm sorry but I didn't understand exactly how you've designed your application.
You say you create several instances of the same class, but then you have a destructor calling the release method. The destructor calls the release method on what? What is the relation between the classes?
You say addref is called when you call engine->CreateContext. But addref is called on what? When engine->CreateContext is called AngelScript shouldn't be calling addref on anything. If that is happening, something is seriously wrong.
I want to help you figure out what is wrong, but I need more information to do that.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Thanks WitchLord.
But I have the similar problem too.
I implement my private string class, and it works fine with older version.
But when I upgrade to 2.20.2, it raise some strange excetion in Release().
If I re-arrange the C-class member, the exception will disappear.
I couldn't reproduce this problem with CScriptString.
May I send the testing program to you ?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Let's say we have a class like this:
class CTestObj
{
public:
std::string b;
}
If the application registers the string type as a reference counted wrapper that holds the std::string as a member, similarly to how the CScriptString add-on works, the application must not register the member b as being of that type. This is because AngelScript may need to call the AddRef/Release behaviours on the CScriptString type in order to guarantee the lifetime of the object for some operations. If that is done, the AddRef/Release behaviour will end up changing memory that doesn't belong to the string b.
The AddRef/Release behaviour is usually only called when a method of the object that returns a reference is called, so you might get away without any problems if this never happens.
This is change from previous versions of AngelScript, because script functions and methods weren't allowed to return references before, so AngelScript didn't need to make this extra call to AddRef/Release to secure the lifetime of the returned reference (as it is assumed the application developer knows not to return references to memory that will be invalid as soon as the function returns).
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