Implementing a Type Field copy with Reflection?

BlitzMax Forums/BlitzMax Programming/Implementing a Type Field copy with Reflection?

I can't help you with the reflection, but here's a handy general function for copying types which seems to work.

Type Tcake
	Field x,y
End Type

Function copytype(src:Object,dest:Object,thesize)
	MemCopy(Byte Ptr(dest),Byte Ptr(src),thesize)
End Function

my:Tcake=New Tcake
my.x=5
my.y=6

your:Tcake=New Tcake
copytype(my,your,SizeOf(Tcake))

DebugLog your.x
DebugLog your.y