how to copy types?

Blitz3D Forums/Blitz3D Programming/how to copy types?

magneto(Posted 2004) [#1]
is it possible to copy a type with a simply command?

like: newtype.mytype= copy thistype.mytype


Who was John Galt?(Posted 2004) [#2]
no - have to create a new one and copy across by hand, field by field. You can create a reference to the existing one with newtype.mytype=thistype.


Neo Genesis10(Posted 2004) [#3]
Do you specifically need a copy? If not, you can create a pointer to the same type using the following command:
player.myplayer = New player;
p1.myplayer = player;



Warren(Posted 2004) [#4]
Yeah, it would be nice to be able to copy the contents of a type instance into another one, but AFAIK it's not currently possible.


Techlord(Posted 2004) [#5]
As Falken stated, you have to do it manually. I found a need to copy or mimic types so often, I included a type copy function in my TypeWriter][ Code Wizard. Examples of code produced by the Code Wizard can be found here.


_PJ_(Posted 2004) [#6]
If you need to do this a lot of times or for a large number of types etc. I suppose a function could be created to make it a little more automated/easier