TYPE data delete

Blitz3D Forums/Blitz3D Programming/TYPE data delete

Naughty Alien(Posted 2007) [#1]
..guys how to delete content of already created Type structure?

Type MyData
field X#
field Y#
field Z#
end type

then I fill this like this, for example..

Fill.MyData=New MyData
for i=1 to 100
Fill\X#=SomethingX
Fill\Y#=SomethingY
Fill\Z#=SomethingZ
next

so..what I want is to delete this old data and fill with new one every time I call function wich containing given structure...how to do that with Types??


Vertigo(Posted 2007) [#2]
Well if you will be using the same object each time, you can use a handle and then delete that type each time, however, you can just overwrite the data in the type.

<code>
At the start of your code or whatever create a new instance of the object.

My.MyData = new MyData

then whenever you want call a function to write to that one object.

FillData(My,"Hello",1.1,7)

Function FillData(A.MyData, String$,Float#,Integer%)

A\X# = whatever float
A\Y# = Float#
A\S$ = String$

end function

</code>

Be sure to make an object handle if you will be passing that object between functions outside of your main loop, or include an object reference within the function call.

Did that help?


Naughty Alien(Posted 2007) [#3]
..okay..this is clear..thanks Vertigo..