Delete Only One Type?
BlitzPlus Forums/BlitzPlus Programming/Delete Only One Type?
| ||
Type test Field t1,t2,t3 End Type For test.testtype = Each testtype Delete test Next It deletes all types I only need it to delete one type |
| ||
All you need to do to delete a single type object is:- Delete test Where 'test' holds a pointer to the type object that you want to delete. If you need to iterate through your list of types to find the one that need to be deleted then use some sort of id to identify the individual objects in the type list. Type testtype Field id Field t1,t2,t3 End Type test.testtype = New testtype test\id = 123 For test = Each testtype If test\id = 123 Then Delete test Next |
| ||
Try to not call types and instances by the same name. A common practice is to put "T" at the start of type name,so Type Ttest I can see that Zethrax has done this (in a different way), but wanted to explicitly point it out. I also would "I" instances and "L" loop variables Itest.Ttest = New Ttest Itest\id = 123 For Ltest = Each Ttest If Ltest\Fid = 123 Then Delete Ltest Next |