Advertisement

Creating transparent objects without addref and release

Started by June 25, 2011 01:55 AM
1 comment, last by _orm_ 13 years, 7 months ago
Hello all:
I am trying to expose the world class to my scripting interface. The thing is, I don't want to just create dummy functions to handle addref and release since I am trying to keep this as moduler as possible. Is there a way that I can do this without those extra functions?
Also: I will be creating objects later that will work with the engine that scripting can create. What do I do when the ref is zero? can I just delete this?

Thanks
If the world class is a singleton you can register it with the flag asOBJ_NOHANDLE. In this case the addref and release behaviours shouldn't be registered.

For objects that use reference counting, refCount == 0 means that there are no references to the object so it is safe to delete it.

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
One thing that I do extensively in my engine is I register global functions that reach into the guts of the engine and mess around. This works for me because the scripts are only ever run when the pointers thst the functions manipulate are guaranteed to be valid.

This topic is closed to new replies.

Advertisement