Getting Type Names

BlitzMax Forums/BlitzMax Programming/Getting Type Names

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.

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()


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?

You need to Import BRL.Reflection

(assuming your BlitzMax is up-to-date)

Reflection was introduced in Bmax 1.26. What level are you using?

Thank you.
It seems to have worked.