Class member variables can be registered with RegisterObjectProperty so that they can be directly accessed by the script without the need for any method calls.
If a class member is indirect, i.e. the class holds a pointer to the member that is allocated on the heap, then it is possible to registered the property using & to tell the script engine that a dereference is needed to access the member.
Of course, the application must make sure the pointer is valid during the whole time that it may be accessed from the script.
Remember, in C++ it is not possible to take the address of class members declared as references, because the & operator in this case gives the actual reference that the member is referring to. For this reason it is not possible to use asOFFSET to determine the offset of members declared as references. Instead the offset can be manually calculated relative to an adjacent member. Remember to verify the byte alignment and possible padding added by the compiler.
If the application class that is being registered uses composition, then it is possible to register the properties of the composite members like this:
The last parameter indicates that to reach the property of the composite member it is necessary to dereference the pointer. If the composite member is inlined, then the parameter should be set to false.
It is also possible to expose properties through property accessors, which are a pair of class methods with prefixes 'get_' and 'set_' and the function decorator 'property' for getting and setting the property value. These methods should be registered with RegisterObjectMethod. This is especially useful when the offset of the property cannot be determined, or if the type of the property is not registered in the script and some translation must occur, i.e. from char* to string.
If the application class contains a C++ array as a member, it may be advantageous to expose the array through indexed property accessors rather than attempting to matching the C++ array type to a registered type in AngelScript. To do this you can create a couple of simple proxy functions that will translate to the array access.