Hi,
I've noticed that SquirrelObject doesn't contain a comparison operator so I was thinking of implementing the following code for easier object comparisons in C++. It makes use of sq_cmp to do the comparison.
bool & SquirrelObject::operator ==(SquirrelObject &o)
{
bool cmp = false;
int oldtop = sq_gettop(hSquirrelVM);
sq_pushroottable(hSquirrelVM);
sq_pushobject(hSquirrelVM, GetObjectHandle());
sq_pushobject(hSquirrelVM, o.GetObjectHandle());
if(sq_cmp(hSquirrelVM) == 0)
cmp = true;
sq_settop(hSquirrelVM, oldtop);
return cmp;
}
Is there a reason why this feature wasn't included in the first place?