Getting Type Names

BlitzMax Forums/BlitzMax Programming/Getting Type Names

DirtBikeDude(Posted 2008) [#1]
Is it possible to get the name of a custom type?
If so, is it possible to get the name of an extended type and it's base type separately?

Thank you.


Azathoth(Posted 2008) [#2]
Like this?

Type Custom
EndType

Type Custom2 Extends Custom
EndType

Local a:Custom2=New Custom2

Local aID:TTypeId=TTypeId.ForObject(a)

Print aID.Name()
Print aID.SuperType().Name()



DirtBikeDude(Posted 2008) [#3]
For some reason I get the Error "Identifier 'TTypeId' not found".

Global ActObj:TList = CreateList()	'Active Objects

For Local Obj:Object = EachIn ActObj
	Local ObjTyp:TTypeId = TTypeId.ForObject( Obj )	'Type ID
	
	If ObjTyp.Name() = "Ladder"
		'Physics
		'*Check if at End of Ladder
		'*Check for Next Ladder
		
		'Climb Ladder
	End If
Next


What could cause this?


Brucey(Posted 2008) [#4]
You need to Import BRL.Reflection

(assuming your BlitzMax is up-to-date)


tonyg(Posted 2008) [#5]
Reflection was introduced in Bmax 1.26. What level are you using?


DirtBikeDude(Posted 2008) [#6]
Thank you.
It seems to have worked.