Followers 0

Transferring methods to global namespace

1 post in this topic

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?
0

Share on other sites
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.

0

Create an account

Register a new account