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: How to compare more than 1 variable

Previous Thread :: Next Thread 
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:25 PM
Im pretty sure this is how to do it, But you make the variables for lets say... A vote.

i = 3

x = 4

p =1




lets say that "" got 3 votes and "x" got 4 and "p" got 1
Now put them into a table.


Local Votes = {i, x, p}


Now that we have our table lets move on.
"How do I compare them" you may ask. Well its hard to a compare really what you do is sort the table, so use this call.

table.sort(Votes) --Parameter is the table

Now it should short this table into highest to low.
"How do I get the number now??"
To get the Highest number you must also note that a tables variables can be called with [1], [2], so on, but it needs to be infant of the table name for example "Vote[1]". 1 is the first variable in the table, 2 is the second, and it continues to however many there are, so when we call [1] it should be the highest which is x since we did sort.table(Votes).

Now you can use this for anything needed! Might as well just print it.

print('The winner is "..Votes[1])
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:29 PM
Very Easy
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:29 PM
Anyone is welcome to reply on what they will use it for or such.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Jul 2015 01:30 PM
I don't know why randoms think they can post tutorials when we already have wiki documentation. lold
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:32 PM
TimeTicks, dude first off not random, second off just helping people on here that don't use the wiki.... ever and you should know about that.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Jul 2015 01:33 PM
People who don't use the wiki are upright idiots. End of story.
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:36 PM
Its true, but you can't stop it from happening.
Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
04 Jul 2015 01:36 PM

print(math.max(i,x,p))
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
04 Jul 2015 01:47 PM
Not to mention that almost everyone who posts a guide can't script
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 01:48 PM
Are you kidding me kid? I started scripting 18 days ago, and can script better than you. So don't even go there.
Report Abuse
Skelecore is not online. Skelecore
Joined: 13 Mar 2015
Total Posts: 1447
04 Jul 2015 02:06 PM
You sir, are an idiot.


+10,954 Posts | NeonSkelion/SpinalCode 3 Day'd | ℓισивαιтα אָ иєσиѕкєℓισи | иαмαѕтє ✿◕ ‿ ◕✿ нαρριиєѕѕ αωαιтѕ уσυ
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 02:08 PM
Ok, so I am the Idiot? Two things. You don't know my GPA, and my IQ so saying Im the idiot makes you the idiot for making a statement that makes no sense. Now hat you did that I can call you the idiot.
Report Abuse
DevRenza is not online. DevRenza
Joined: 12 Jun 2015
Total Posts: 425
04 Jul 2015 02:08 PM
Idiot.
Report Abuse
Skelecore is not online. Skelecore
Joined: 13 Mar 2015
Total Posts: 1447
04 Jul 2015 02:11 PM
Your reply made no coherent sense, all I gathered from it's pitiful ramblings was GPA and IQ. Thinking I was referencing to them in anyway proves your idiocy further and further. Now get out before I end up doing something I regret.


+10,954 Posts | NeonSkelion/SpinalCode 3 Day'd | ℓισивαιтα אָ иєσиѕкєℓισи | иαмαѕтє ✿◕ ‿ ◕✿ нαρριиєѕѕ αωαιтѕ уσυ
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
04 Jul 2015 02:12 PM
print(math.max(i,x,p))

[2]
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
04 Jul 2015 02:45 PM
I think you meant

local Votes = {i, x, p}


And if you really want the most votes; use math.max, this is what it's made for:

print("The winner is "..math.max(i, x, p))
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