sorting table with 2 values

I am saving a score (integer) and string in a table. The score and string need to be linked and then sorted like below:

table = { {“string”, 10}, {“string2”, 22}, {“string3”, 6} }

how can I sort these in terms of the score value? [import]uid: 3018 topic_id: 9837 reply_id: 309837[/import]

Easy-peasy:
[lua]local function sortASC(pair1,pair2)
return pair1[2] < pair2[2]
end

– tab, not table as table is a table holding tables functions
tab = { {“string”, 10}, {“string2”, 22}, {“string3”, 6} }

table.sort( tab, sortASC )[/lua] [import]uid: 51516 topic_id: 9837 reply_id: 35849[/import]

Real powerful and real Easy-peasy!!!

thx seth… [import]uid: 84539 topic_id: 9837 reply_id: 80739[/import]