What type is a passed object?
BlitzMax Forums/BlitzMax Beginners Area/What type is a passed object?| 
 | ||
| 
pImage:TPixmap=CreatePixmap(100,100,1)
Function Something(url:Object)
  Print url.tostring()
  End Function
Something("hello world")
Something(pImage:TPixmap)
End
In the above code, how can I tell what type of object has been passed? Where I "print url.tostring()", How could I tell if this Object is a string or a pixmap?. | 
| 
 | ||
| Simple 
If String(url)
    Print "String"
Else If TPixmap(url)
    Print "Pixmap"
End If
 | 
| 
 | ||
| awesome, ta! | 
| 
 | ||
| You could use reflection too.. Print TType.ForObject(url).Name() | 
| 
 | ||
| It's good to know alternatives, but for this case I'd avoid reflection as it is slow :) |