-
Notifications
You must be signed in to change notification settings - Fork 3
5. Variable Accessors
MEMBER keyword works as an internal accessor; MEMBER checks the encapsulation standard: is there a an existing object variable with the right name, and right type according to the instanciation of this class..
You can set a variable encapsulate by the object through the keyword MEMBER
private _foo = "foo";
MEMBER("foo", _foo);
or directly
MEMBER("foo", "foo");
There is some limitation relative to the translation of macro example with array, you can not use directly an array containing coma like this
MEMBER("foo", ["value1"`**,**` "value2"]);
you will have to use a temp array:
private _array = ["value1", "value2"];
MEMBER("foo", _array);
but this setter works fine:
MEMBER("foo", []);
In other try you can not define a variable value like this :
MEMBER("foo", nil) = foo;
But this kind of syntax works nice with array:
MEMBER("foo", nil) pushback "foo";
In the same way, you can use a foreach:
{ } foreach MEMBER("foo", nil);
You can get a variable encapsulate by the object through the keyword MEMBER with usage of nil
private _yourvariable = MEMBER("foo", nil);
You can set a special accessor to get a PRIVATE variable from outside of your object, using the FUNC_GETVAR macro.
PUBLIC FUNCTION("","getMyVariable") FUNC_GETVAR ("getMyVariable");