generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Table sorting

Previous Thread :: Next Thread 
chimmmihc is not online. chimmmihc
Joined: 24 Jul 2014
Total Posts: 2420
19 Oct 2015 05:46 AM
Anyone know of a super quick sorting algorithm? I'm sorting a table from least to greatest 1, to 10.
Report Abuse
Rocketerkid is not online. Rocketerkid
Joined: 10 Oct 2011
Total Posts: 1237
19 Oct 2015 05:57 AM
Could you explain a bit more?
Report Abuse
chimmmihc is not online. chimmmihc
Joined: 24 Jul 2014
Total Posts: 2420
19 Oct 2015 06:02 AM
How can I sort a table of numbers from 1, to 10. For example {1,9,6,7,3} to {1,3,6,7,9}
Report Abuse
Rocketerkid is not online. Rocketerkid
Joined: 10 Oct 2011
Total Posts: 1237
19 Oct 2015 06:06 AM
table.sort()?

x = {1,9,6,7,3}
table.sort(x)
for i,v in pairs(x) do
print(v)
end
Report Abuse
chimmmihc is not online. chimmmihc
Joined: 24 Jul 2014
Total Posts: 2420
19 Oct 2015 06:15 AM
Would this work if I had something like t = {{value, 5}, {value, 7}, {value, 1}}
Report Abuse
FlyNormal is not online. FlyNormal
Joined: 30 Sep 2015
Total Posts: 344
19 Oct 2015 06:39 AM
In that case, you will need to use the 2nd argument of table.sort.


table.sort(t, function(a, b) return a[2] < b[2] end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image