Author Topic: Quetion about retrieving values  (Read 1218 times)

0 Members and 1 Guest are viewing this topic.

Offline Schiaffino

  • Jr. Member
  • **
  • Posts: 88
  • Karma: 1
Quetion about retrieving values
« on: December 20, 2014, 12:16:22 PM »
Hello guys, well i think the title is not the correct huh... im sorry :S

Well i've been trying to make an small hud that spawn at the corner but im retrieving all the Player's online values, is there a way to retrieve the top 5? like show only the TOP 5 ?

here is part of my code:

Code: [Select]
local tbl = player.GetAll()
table.sort(tbl, function(a, b) return (a:getDarkRPVar("kills") or 0) > (b:getDarkRPVar("kills") or 0) end)

Is there a way to make it like only get first 5 values :C

Thanks for the help <3