class Vector {
float X, Y, Z;
Vector() {}
Vector(float x, float y, float z) {
X = x;
Y = y;
Z = z;
}
}
class MyClass {
private void Test() {
auto v = Up;
}
Vector get_Up() const property {
return Vector(0, 1, 0);
}
}
The method get_Up is declared with property and as such Angelscript allows us to use this method as a property without the get_ prefix and without calling it:
auto v = Up;
However, the above line of code will be underlined with an error and the property Up will not be offered for completion:
Although, in a real script one would use the "normal" way of declaring getters and setters, when registering them from the application side, we must still use the function version.
It is also important to note the ScriptEngine option asEP_PROPERTY_ACCESSOR_MODE that changes the behavior, so the LSP might consider allowing for this option as well. More info here.
Consider the following example:
The method
get_Up
is declared withproperty
and as such Angelscript allows us to use this method as a property without theget_
prefix and without calling it:However, the above line of code will be underlined with an error and the property
Up
will not be offered for completion:Although, in a real script one would use the "normal" way of declaring getters and setters, when registering them from the application side, we must still use the function version.
More info can be found here.
It is also important to note the
ScriptEngine
optionasEP_PROPERTY_ACCESSOR_MODE
that changes the behavior, so the LSP might consider allowing for this option as well. More info here.