Difference between revisions of "Dynamic Storage"
Byline removed - Error tag removed (added a note to solve it) - Unfinished tag removed (seems finished to me)
imported>Haama (Updated warning) |
imported>QQuix (Byline removed - Error tag removed (added a note to solve it) - Unfinished tag removed (seems finished to me)) |
||
Line 1: | Line 1: | ||
Preamble note: Since OBSE (not to mention Pluggy) has added array manipulation to Oblivion script language, the implementation described in this article is only meaningful for modders that don't want to use OBSE in their mods. | |||
==Warning== | ==Warning== | ||
Line 76: | Line 69: | ||
So, if this code actually compiled, it would create a list with 20 elements, each element having a reference to the next element in the list, and since there has to be a front of the list, the first element's reference is stored in the Head reference variable. So if we write the list out starting from the head and using Node# where # is the Number stored in the node, we would see that the list looks like this: | So, if this code actually compiled, it would create a list with 20 elements, each element having a reference to the next element in the list, and since there has to be a front of the list, the first element's reference is stored in the Head reference variable. So if we write the list out starting from the head and using Node# where # is the Number stored in the node, we would see that the list looks like this: | ||
Head->Node0->Node1->Node2-> . . . ->Node18->Node19. Where -> is shorthand for "Has a reference to" so Head has a reference to Node0 who has a reference to Node1 and so on. If we wanted to print out the Number of every node in the list we would write that code like this (let's assume we have already built the list with Head as the first element): | Head->Node0->Node1->Node2-> . . . ->Node18->Node19. Where -> is shorthand for "Has a reference to" so Head has a reference to Node0 who has a reference to Node1 and so on. If we wanted to print out the Number of every node in the list we would write that code like this (let's assume we have already built the list with Head as the first element): | ||
Note that the above is just a simplified, conceptual code, as you cannot access script variables the way it is coded (set Curr.Number to count", etc). Check [[Linked List Tutorial]] for a more realistic approach. | |||
<pre> | <pre> | ||
long count | long count |