DakiLLa

max value

Recommended Posts

hi. i have one problem here..

i want to get a player with max value of points and print his name. Lets suppose that we have 3 players with their points:

First - 500 points

Second - 1000 points

Fird - 2000 points

how to check which player has more points than all others players?

May be create a table with players? if it's, how to make this points-check?

Thx for replies :)

Share this post


Link to post
  
bla = {} 
  
bla[500] = "player1" 
bla[1000] = "player2" 
bla[2000] = "player3" 
  
print(bla[table.maxn(bla)].." has the highest score.") 
  

Share this post


Link to post

Wouldn't work if two people would have 2000 points at the same time..

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.