Re-order array

BlitzMax Forums/BlitzMax Beginners Area/Re-order array

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

If you want to do it fast. Use Ziggys input as beginning but don't do it the overkill approach (ValueAtIndex is a no go for heavier usage).

Store the TLink that you get on AddFirst / AddLast within your object.

Now if you want to reorder, you can use that link and the before() / after() to get the item straight in front / after in the list.
Now you can easily swap the elements by using the AddAfterLink / AddBeforeLink feature of the list. (don't forget to store the link again and to remove the previous tlink before doing so!)