I have this piece of code that uses a c++ side class called "gameobject" which is registered with AS as asOBJ_VALUE:
class LevelObjects
{
LevelObjects()
{
mPlayer = "player";
}
const gameobject& getPlayer() { return mPlayer; }
private gameobject mPlayer;
}
The above code seems to work. At least it compiles. If I try to make the getPlayer method a property I get the following errors:
ERROR: Component source code (8, 30): Expected '('
class LevelObjects
{
LevelObjects()
{
mPlayer = "player";
}
const gameobject& player { get { return mPlayer; } }
private gameobject mPlayer;
}
If I remove the "const" and the "&" from the property it does compile, but I assume that creates a new temp copy of gameobject every time I use the property. I would like to avoid doing that.
Is this not supported or am I doing something wrong? The version of AS I am using is 2.31.1.