I wrote a c++ class like
class Vector3
{
//...
inline Vector3 & setX( float x )
{
val[0] = x;
return *this;
}
// Set the y element of a 3-D vector
//
inline Vector3 & setY( float y )
{
val[1] = y;
return *this;
}
// Set the z element of a 3-D vector
//
inline Vector3 & setZ( float z )
{
val[2] = z;
return *this;
}
}
I use sqplus bind the script
DECLARE_INSTANCE_TYPE(Vector3)
SQClassDef<Vector3> v3def(_T("Vector3"));
v3def.overloadFunc<Vector3& (Vector3::*)(float)>(&Vector3::setX,_T("setX"));
v3def.overloadFunc<Vector3& (Vector3::*)(float)>(&Vector3::setY,_T("setY"));
v3def.overloadFunc<Vector3& (Vector3::*)(float)>(&Vector3::setZ,_T("setZ"));
The script wrote like
local vec = Vector3();
vec.setX(1.0).setY(2.0).setZ(3.0);
But the z and y of vec is zero.x is 1.0
Help me please.