I'm not proud of this, and am not certain if it works on all platforms or will with future updates but interesting non-the-less...
Implementing your function is as simple as...
'Returns a pointer to a class for a given object 'obj' Function GetClassForObject:Byte Ptr(obj:Object) Local objPtr:Int Ptr = Int Ptr((Byte Ptr(obj)) - 8) Return Byte Ptr(objPtr[0]) End Function 'Returns a pointer to the super-class of a class pointed to by a given pointer 'class' Function GetSuperClass:Byte Ptr(class:Byte Ptr) Return Byte Ptr((Int Ptr(class))[0]) End Function 'Returns the name of a class pointed to by a given pointer 'class' Function GetClassName:String(class:Byte Ptr) If Not class Then Return Null Local debug_scope:Int Ptr = Int Ptr((Int Ptr(class))[2]) Local szClass:Byte Ptr = Byte Ptr(debug_scope[1]) Return String.FromCString(szClass) End Function 'Returns the name of the class for a given object 'obj' Function GetClassNameForObject:String(obj:Object) Return GetClassName(GetClassForObject(obj)) End Function 'Returns TRUE for an object 'obj' that has a super class named 'className', otherwise returns FALSE Function IsInstanceOf:Int(obj:Object, className:String) className = className.ToLower() Local class:Byte Ptr = GetClassForObject(obj) While GetClassName(class).ToLower() <> className class = GetSuperClass(class) If Not class Return False Wend Return True End Function
Implementing your function is as simple as...
Function IsThisJustABob:Int(i:Bob) Return GetClassNameForObject(i) = "Bob" End Function