Skip to main content
GameDev.net gamedev.net
🔒 Locked

AngelScript and static method

Started by Alfonso Miraglies Jun 12, 2012 at 9:54 AM 2 replies 7.4k views
Original Post
Alfonso Miraglies
Alfonso Miraglies
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?
TechRogue
TechRogue
Why not just use a global function?
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
Alfonso Miraglies
Alfonso Miraglies
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. ;)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.