ID:149000
 
Usually, I can do something as simple as this. But today, it just won't come to me. So, I'm looking here for some help. :)

I need to move all of the index values of a list up by one in the list. In case you aren't following me, something like this:

var/generic_list[200]
generic_list[2] = generic_list[1]
generic_list[3] = generic_list[2]
.
..
...
etc.

Now, not only does that not work (because it erases the value before it even assigns it), it would take too long to do. I need it in the form of a loop.

====================================
I'm just not with it today. ~_~

mob/Malver
var/not_with_it = TRUE
Malver wrote:
I need to move all of the index values of a list up by one in the list. In case you aren't following me, something like this:
var/generic_list[200]
generic_list[2] = generic_list[1]
generic_list[3] = generic_list[2]
.
..
...
etc.

Now, not only does that not work (because it erases the value before it even assigns it), it would take too long to do. I need it in the form of a loop.

You're doing it backwards. Or rather, forwards, which is the wrong way. The last value should be moved up first, then the next-to-last, and so on.
It's an easy loop to write, so I won't even bother with that part.

Ultimately what DM needs is a list.Insert() function. I've been clamoring for one for ages now. Post a request in General and you can add to the impetus to get this put in. (It shouldn't be a hard thing to add.)

Lummox JR
In response to Lummox JR
Thanks.

I still can't believe I didn't think of that. :P