Lists
BlitzMax Forums/BlitzMax Beginners Area/Lists| 
 | ||
| I am in need of a little help.  I'm writing a program which requires a container that can expand, while being able to retain the former information.  It would seem like a List would be the way to go. But I can't seem to figure out how a List stores info.  Does it merely link to info, or can it actually store it. Can I create a Local object, and add it to a list, and then have that object be destructed while retaining the info in the list? | 
| 
 | ||
| No. | 
| 
 | ||
|  I'm writing a program which requires a container that can expand, OK, that would be lists and arrays (using slicing) and maps. Depending on how you want to access the data lists seem a viable choice.  But I can't seem to figure out how a List stores info. Does it merely link to info  Yes using a TLINK.  can it actually store it.No. A link is stored in the list.  Can I create a Local object, and add it to a list, and then have that object be destructed while retaining the info in the list?  Yes. The link will stop it from being Garbage collected. | 
| 
 | ||
| So I can do something like: Method AddSubSkill(NewSubSkillName:String, NewSubSkillValue:Int) Local NewSubSkill:TSkill 'A Type that contains a value, and a Name. NewSubSkill.Name = NewSubSkillName NewSubSkill.Value = NewSubSkillValue ListAddLast SubSkills, NewSubSkill End Method And that would work? | 
| 
 | ||
| yerp | 
| 
 | ||
|  have that object be destructed while retaining the info in the list Think about this carefully and you'll see the two are mutually exclusive. |