Reflection Question
BlitzMax Forums/BlitzMax Programming/Reflection Question| 
 | ||
| Let's say I have a type TPerson, with a field name$. I define one: joe:TPerson = new TPerson I want to automatically populate joe's name field with the name of the object, in this case "joe". In the docs for reflection, I could only find the Name field which would appear to return TPerson. Any ideas? | 
| 
 | ||
| 
SuperStrict
Type Tperson
	Field name:String
End Type
Local joe:Tperson=New Tperson
Local id:TTypeId=TTypeId.ForObject(joe)
For Local fld:TField=EachIn id.Enumfields()
	
	Print "Field '"+fld.name()+"'"
	If fld.name()="name"
		fld.Set joe,String("Joe")
	End If
Next	
Print joe.name
 | 
| 
 | ||
| Ahh, I understand now.  Thanks a lot! |