Sign in to follow this  
WitchLord

AngelScript getters and setters (WIP)

Recommended Posts

I'm making good progress on the support for getters and setters in AngelScript. I still have some tests to write but I think they are already working pretty well. For that reason I'd like for whoever intend to use these to give the new feature a try, to see if we can root out any potential bugs before I release version 2.17.1. You add getters and setters in objects (both script classes and registered types) by declaring a couple of methods like this:
class MyObject
{
   int get_Prop() { /* return the value */ }
   void set_Prop(int v) { /* set the value */ }
}
When accessing the member Prop of this class, the correct property accessor method will be called based on what the expression is used for. Observation: Both the get and set methods must have matching types, otherwise the compiler won't know what type to use. Please download the latest revision from the SVN, and let me know if you encounter any problems with the getters and setters.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this