Al Mackey hits the nail right on here..
Basicly you create a pointer to a particular item in the list:
Type Item
Field Contents
End Type
MyPointer.Item = New Item
This adds a new item to the item type AND returns the address of that type to the MyPointer variable.
This means that MyPointer contains an unique integer/address that points to the memory location of the particular type instance that was just created.
If we do this:
For x = 0 to 4
MyPointer.Item = New Item
Next
We have created 5 new items to the Item type list, and every time a new one is created, the MyPointer variable will contain its address.
If we type this:
MyPointer.Item = First Item
We assign MyPointer with the address of the first Item in the list.
You have noticed that I make sure to put .Item behind MyPointer every time..
I do this because I am creating local variables with the name MyPointer.. Every time you create a new variable that is going to be a type pointer, you have to typecast the variable.
So consider this:
Type Truck
Field Cargo
Field Fuel
End Type
Type Car
Field Fuel
End Type
Notice the difference between these different types.. the Truck type needs more memory than the Car type because it has one extra field.
Blitz needs to know this when you create a variable to use as a type pointer.
MyPointer.Truck will reserve the exact amount of memory needed for two fields.
MyPointer.Car will only reserve the memory for one field.
So the name of the variable/pointer doesn't really matter, just how you typecast it.
If you really wish for a real linked list with sublists, you can easily code it using blitz's types and typepointers.
I realize that this explaination is more of a ramble than a good way to teach something ^^
Basicly you create a pointer to a particular item in the list:
Type Item
Field Contents
End Type
MyPointer.Item = New Item
This adds a new item to the item type AND returns the address of that type to the MyPointer variable.
This means that MyPointer contains an unique integer/address that points to the memory location of the particular type instance that was just created.
If we do this:
For x = 0 to 4
MyPointer.Item = New Item
Next
We have created 5 new items to the Item type list, and every time a new one is created, the MyPointer variable will contain its address.
If we type this:
MyPointer.Item = First Item
We assign MyPointer with the address of the first Item in the list.
You have noticed that I make sure to put .Item behind MyPointer every time..
I do this because I am creating local variables with the name MyPointer.. Every time you create a new variable that is going to be a type pointer, you have to typecast the variable.
So consider this:
Type Truck
Field Cargo
Field Fuel
End Type
Type Car
Field Fuel
End Type
Notice the difference between these different types.. the Truck type needs more memory than the Car type because it has one extra field.
Blitz needs to know this when you create a variable to use as a type pointer.
MyPointer.Truck will reserve the exact amount of memory needed for two fields.
MyPointer.Car will only reserve the memory for one field.
So the name of the variable/pointer doesn't really matter, just how you typecast it.
If you really wish for a real linked list with sublists, you can easily code it using blitz's types and typepointers.
I realize that this explaination is more of a ramble than a good way to teach something ^^