• Advertisement
Sign in to follow this  

Transferring methods to global namespace

This topic is 4951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


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


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement