mIRC Home    About    Download    Register    News    Help

Print Thread
#3788 28/12/02 07:51 PM
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
hey,just wondering how hash tables sorts the items and data in them, are they sorted in order from,:
1 = 1st added
2 = 2nd added
3 = 3rd added
etc etc

or ?

#3789 28/12/02 10:07 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
They are not sorted at all. To show this, I typed the following:
Code:

/hmake test 10
/hadd test 3 First entry
/hadd test 1 Second entry
/hadd test 2 Third entry
//var %i = 1 | while ($hget(test,%i).item) { echo -ati2 * $ifmatch = $hget(test,$ifmatch) | inc %i }
* 2 = Third entry
* 3 = First entry
* 1 = Second entry


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#3790 28/12/02 10:26 PM
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
ok, i just wanted to know if they were "sorted" by the order they were added to the table, guess not tho :P

#3791 28/12/02 11:23 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
A $hsort identifier was suggested in the old suggestions board. Let's hope K does something about it.


Link Copied to Clipboard