How to Check for a given type?

BlitzMax Forums/BlitzMax Beginners Area/How to Check for a given type?

Hello!

Please excuse this probably *very* basic question, but I could not find the answer neither by reading through the online help nor by searching this forum:

- how do I determine, whether a given variable is of a given type?
- is there an "is" operator?

Examples
- a is byte
- a is TList

Thanks in advance for any responses!

If TList(hello) Then Print "hello is a TList"
If TPixmap(hello) Then Print "hello is a TPixmap"
etc.
Notice that byte, int, float, etc. may be converted to each other by using a similar approach, so I'm not sure how you would handle that...

Only objects can be cast back and forth from base types including strings and arrays.

a=TList(b)
if 'a' contains a reference 'b' is a type of TList otherwise 'a' contains null.

Hello Mikkel! Hello Paul!

Thanks for the quick response...

It looks as if I would have to try a type casting and check if that fails...