03 June 2018, 06:56 | #1 |
Warhasneverbeensomuchfun
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
|
Sortlist command
Simple question... what's the syntax of the Sortlist command on BLitz 2?
I just cant use it. I have a list called "objects" I've tried SortList objects SortList objects() SortList (objects) SortList (objects()) all of them give me syntax errors How do I use this command? Thank you! |
03 June 2018, 07:21 | #2 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
The manual says:
SortList Arrayname() ... The order in which the items are sorted depends on the first field of the linked list type which must be a single integer word... |
03 June 2018, 07:22 | #3 |
Warhasneverbeensomuchfun
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
|
Thank you, but I do have the manual open all time, I had already seen what the manual says. It still doesn't help me at all. (The manual is very vague on many points unfortunately)
|
03 June 2018, 10:17 | #4 |
Registered User
Join Date: Oct 2008
Location: Finland
Posts: 643
|
Yep, I agree that the manual can be a bit vague. Does this help at all, it has some sizeof argument?
http://amiga.sourceforge.net/amigade...&action=Search |
03 June 2018, 23:23 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
Yeah, you need to tell it the size of the elements in the array you're sorting. This makes it a much faster command because it can then make assumptions on how many bytes to move instead of having to calculate it. The sizeof argument is the number of bytes a single element of the list takes up. You can either provide the absolute number, like this:
Code:
SortList objects(), 4 Code:
SortList objects(), SizeOf .l Code:
SortList objects(), SizeOf .myNewType |
04 June 2018, 02:59 | #6 |
Warhasneverbeensomuchfun
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 41
Posts: 3,450
|
GODDAMN IT the Manual says absolutely NOTHING about this! Thank you guys for the help!
|
04 June 2018, 15:06 | #7 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,217
|
If you wanted to reverse-sort the list you'd need to store the complement of the sort criteria, I guess? A bit of a pain.
|
04 June 2018, 15:21 | #8 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
Depending on what you're sorting, the RISortLib might be of use to you. It can perform alphabetical sorting of a linked list array in either order. Numerical sorting in reverse order doesn't appear to be that easy, however I think it's not that bad if the list is being traversed - just work upwards instead of downwards.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Final Command | runamuck2 | support.Games | 7 | 13 September 2019 16:17 |
Is there a WB command at all that can... | MethodGit | request.Other | 43 | 10 October 2010 09:06 |
What is the WB command that..... | MethodGit | request.Other | 4 | 08 October 2010 04:21 |
msdos command ? | turrican3 | request.Apps | 31 | 16 January 2008 03:05 |
command line? | Drake1009 | support.WinUAE | 7 | 14 August 2004 17:17 |
|
|