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
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
| |
|
|
| 04 Jul 2015 01:47 PM |
| Not to mention that almost everyone who posts a guide can't script |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
| |
|
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 |
|
|
| |
|
|
| 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 |
|
|