Setting reflection metadata at run-time

BlitzMax Forums/BlitzMax Programming/Setting reflection metadata at run-time

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

SuperStrict

Type Test
	Field  List:Int[2]  {Dog}
	
	Method GetMeta:String(_object:Object)
	
		Local object_id:TTypeId=TTypeId.ForObject(_object)
		Local field_list:TList = object_id.EnumFields()
					
		If field_list 
			For Local object_field:TField=EachIn field_list
				Print object_field.MetaData()
			Next
		EndIf
		
	End Method
	
	Method PrintList()
		Print List[0]
		Print List[1]
		
	End Method
	
	Method New()
		List[0] = 1
		List [1] = 2
	End Method
	
End Type

Type Test2 Extends Test

	Field List:Int[2]  {Cat}
	
	Method New()
		List[0] = 10
		List [1] = 20
	End Method
	
	Method PrintList2()
		Print List[0]
		Print List[1]
	End Method

End Type

Local jack:Test2 = New Test2
jack.PrintList()
jack.PrintList2()
Print jack.GetMeta(jack)

Outputs:
1
2
10
20
Dog=1
Cat=1

Uh oh...