See
http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/SqPlus.html . I made a small change to make this work in a useful way. It works like a cast attempt: if the cast fails, NULL is returned (but no error is set/thrown).
SqPlus stores the instance type name in the VarRef (see SqPlus.cpp). It may be useful in the future to create a GetInstanceTypeName() function for debugging, _tostring() support, etc. Such a function would operate on the owning class or table (the VarRef is stored at that level, not in the instance itself).
Here's how to examine the type (using GetInstanceUP() is simpler and faster if a valid pointer is needed):
SQUserPointer instanceType=NULL;
if (so.GetTypeTag(&instanceType)) {
if (instanceType == ClassType<SoundEffect>::type()) {
lprintf("type is SoundEffect
");
} else {
lprintf("Incorrect type
");
} // if
} else {
lprintf("TypeTag not set: incorrect type
");
} // if
<soundeffect><soundeffect><soundeffect>
Please ignore the "soundeffect " garbage at the bottom of the post: forum software bug (can't delete it).