Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Sorting tables by heading name

Sorting tables by heading name

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Tiopon   USA  (71 posts)  Bio
Date Reply #15 on Sun 25 Apr 2010 12:07 AM (UTC)
Message
One slight change... I did put the 'require "pairsbykeys"' into the code above, so that people who don't realize that they need to enable that as well will still have it working.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #16 on Sun 25 Apr 2010 01:07 AM (UTC)

Amended on Sun 25 Apr 2010 01:15 AM (UTC) by Nick Gammon

Message
I don't see a big problem with making that the default (except perhaps, to confuse people because that will now NOT be the order they will get them programmatically) so I have amended the released version.

Commit 039e557. Edit: Reverted.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #17 on Sun 25 Apr 2010 01:16 AM (UTC)
Message
Ah well that will teach me to not think things through. :-)

I had to revert that change.

Your idea is fine for string keys. However tprint prints generic objects, so the table might consist of (say) functions, strings, booleans, and numbers (as table keys).

It is not meaningful to compare a function to a string, or indeed a function to a function, and thus they can't be sorted.

Your suggested change will only work for a subset of all possible tables.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


48,460 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.