How can I make condition that checks Object Type

BlitzMax Forums/BlitzMax Programming/How can I make condition that checks Object Type

Hardcoal(Posted 2014) [#1]
If I want to check whether an object is from a spcific type for example


   Partical:Type_Partical

   If Partical is Type_Partical Then print "Its a partical"




tonyg(Posted 2014) [#2]
if type_partical(partical) print "it's a partical"

(think I remember it being called casting if you want to search further)


Derron(Posted 2014) [#3]
a type is always "down castable"

type ta
type tb extends ta
type tc extends ta

local a:ta = new ta
local b:tb = new tb
local c:tc = new tc

if ta(a) then print "a is type ta"
if tb(b) then print "b is type tb"
if ta(b) then print "b can be type ta"
if tb(c) then print "c can never be type tb"
if tb(a) then print "this could not happen in Blitzmax, upper casting is not allowed there"


bye
Ron