Transferring methods to global namespace

Started by
0 comments, last by WitchLord 19 years, 9 months ago
Hi, I'm using angelscript in a system with several subsystems, one of them is often used in the scripts. I set a reference to it by using RegisterGlobalProperty(), and it works. However, is there a way to set the subsystems methods global in the scripts? See this example:

subsystem.initQueues();
subsystem.startQueue(0);
for (int i=0;i<subsystem.batchCount();i++)
{
}
.....
I would like to get rid of all these "subsystem."-statements, since they are quite redundant. However, the only way I found to accomplish this is to write proxy functions. So, a way to bind a C++ method to an angelscript function would be nice. Shouldnt be too hard if I specify the pointer of the C++ instance. Is this possible with Angelscript? Or is it an upcoming feature in 0.8?
Advertisement
I can't think of any reasonable way to register an object method as global function unless the method is static. If you want to get rid of the object, then the best approach is to write simple proxy functions. Or design the subsystem to work with static method pointers already from the beginning.


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