freudo Posted June 27, 2014 Share Posted June 27, 2014 Hey guys I have a problem. Why false? photo: code: function tables() outputChatBox("Top 3 Clans:", getRootElement(), 255,255,255) for index, data in ipairs(sortTeams()) do outputChatBox("#"..tostring(index)..": ".. tostring(data.account) .."#f4a460 - #ffffff".. tostring(data.points), getRootElement(), 255, 255, 255,true) if index == 3 then break end end end addCommandHandler("top", tables) function sortTeams() local rowdata = {} for index, v in pairs( getElementsByType("team") ) do rowdata[index] = { account = getTeamName(v), points = getElementData(v,"teampoint"), } end local comparator = function (a, b) return (tonumber(a.points) or 0) > (tonumber(b.points) or 0) end table.sort(rowdata, comparator) return rowdata end Link to comment
Castillo Posted June 27, 2014 Share Posted June 27, 2014 Maybe teams don't have a element data called "teampoint". Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now