This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

More Noob Problems with lsort

Old posts that have not been replied to for several years.
Locked
K
Kry0420

Post by Kry0420 »

ok, i'm trying to using
[lsort -integer -index 1 [array names $planet($hand $text)] ]
$planet($hand $text) returns a name then a number
$text $hand returns the opposite,
both should be on the same line,
and i want to sort it like
lsort -integer -index 1 {{Planet# User}} {{Planet# User}} and by theory:
[lsort -integer -index 1 [array names $planet($text $hand)] ] should return Planet# and User, it returns the error of "planet(Nickname )": no such element in array, i'm a new at working with arrays and i'm probably using the wrong command, i'm lost, please have a little patience and put me on the right path...

<font size=-1>[ This Message was edited by: Kry0420 on 2002-04-08 16:30 ]</font>
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

'lsort' sorts lists

'array names' returns the names of an array

You didn't describe how your arrays are set up, so it's hard to tell, but $planet($nickname $text) is most likely wrong. That means you have an array called planets, and the values in the array are actually names of other arrays. If you have such a complicated system of arrays, maybe you should use a different format. I can't really recommend one because it's hard to tell what you're trying to do.

Anyway, lsort -index x means that each element in the list is actually a sublist, and it sorts it using the x'th element of the sublist. Maybe that's what's wrong.

The more details you provide, the easier it is to help.
Locked