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 » Game Design
Home Search
 

How might I do this

Previous Thread :: Next Thread 
Superwarrior360 is not online. Superwarrior360
Joined: 21 Feb 2013
Total Posts: 2703
27 Dec 2015 05:59 PM
How can I use a script to put a set of numbers in order from least to greatest and find the largest one?
Report Abuse
Judgmentum is not online. Judgmentum
Joined: 23 Aug 2015
Total Posts: 351
27 Dec 2015 06:22 PM
local numbers = {1, 4, 7, 3, 2, 9, 32, 41, 5, 94}

local largestNumber = 0
for i, v in pairs(numbers) do
if v > largestNumber then
largestNumber = v
end
end
print(largestNumber)
Report Abuse
Judgmentum is not online. Judgmentum
Joined: 23 Aug 2015
Total Posts: 351
27 Dec 2015 06:23 PM
btw i had the un-sorted table as an example that it doesn't matter if the table is in order.
Report Abuse
Superwarrior360 is not online. Superwarrior360
Joined: 21 Feb 2013
Total Posts: 2703
28 Dec 2015 01:26 PM
"for i, v in pairs(numbers) do" I can put in a variable/letter other than i, right?
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
28 Dec 2015 01:49 PM
Yes. i is just a variable for the key.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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