Advertisement

Custom object handle behavior

Started by November 19, 2015 06:10 AM
0 comments, last by WitchLord 9 years ago

Hi,

Currently my game is using a purely Unique/Weak ownership system, which appears to be incompatible with Angelscript's shared handles. Basically I need a way to effectively nullify all handles to objects, or at least make them act like they are null.

Would it be possible to do that without modifying the library? Are there any other solutions I can use?

Thanks

Edit:

I should also note that while Angelscript does have a weakref type, I'd prefer that to be the default behavior, at least for objects shared from C++.

Unfortunately it is not easy to nullify all handles to objects. It is possible to enumerate everything, but it would be rather slow if you have lots of objects.

You don't need register your objects with addref/release behaviours though. Just use the flag asOBJ_NOCOUNT to tell AngelScript that no reference counting is needed. Singletons can be registered with the flag asOBJ_NOHANDLE to tell AngelScript that it may not store additional handles to the type, thus allowing you to control where the object is referenced from.

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

This topic is closed to new replies.

Advertisement