Advertisement

AngelScript and static method

Started by June 12, 2012 09:54 AM
2 comments, last by Alfonso Miraglies 12 years, 5 months ago
Hello everybody.
I know in AngelScript the "static" class method is not implemented yet.

By the way, I'm looking for a solution to have something similar.
Do you have any ideas on how to achieve this?
Why not just use a global function?
Advertisement
In C++ a static class method is just a global function within the namespace of the class. As the access to protected and private members can be given to global functions with the 'friend' keyword, there is really no difference at all besides the syntax.

In AngelScript static methods are not yet available (as you already knew), nor is the friend keyword (probably never will be). While class members can be made private, I sincerely doubt it is done a lot in scripts, so the need for static methods doesn't seem very urgent to me.

Is there a specific reason you want to use static class methods in AngelScript? If you have a specific scenario that cannot be solved without it I'll see if I can prioritize this feature.

Regards,
Andreas

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

Thank you really much for the explanation, Andreas.
At the end I just solved, as suggested by Jake, with a global function.

Keep up the good work. ;)

This topic is closed to new replies.

Advertisement