Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
ANRC Universe
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module talk:TableTools
(section)
Add topic
Module
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Add topic
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== keySort documentation or examples please == Could someone add to documentation, or point to good live examples, of the '''{{para|keySort}}''' ''function'', as used in {{slink|Module:TableTools|keysToList|nopage=true}} and {{slink|Module:TableTools|sortedPairs|nopage=true}}? Related to [[:mw:Extension:Scribunto/Lua_reference_manual#table.sort|Lua manual:table.sort]]? I need a simple non-numerical sort ;-) Thx. -[[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 10:19, 20 November 2021 (UTC) :If you provide a short example of dummy data to be sorted I'll have a look. As a quick example, if <code>keys</code> is a list of values each of which might be a number or a string, the following would sort the table so numbers are sorted before strings. <syntaxhighlight lang="lua"> table.sort(keys, function (a, b) if type(a) == type(b) then return a < b elseif type(a) == 'number' then return true end end) </syntaxhighlight> :[[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 23:29, 20 November 2021 (UTC)
Summary:
Please note that all contributions to ANRC Universe may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
ANRC Universe:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Module talk:TableTools
(section)
Add topic