So, as the title says, I would like to sort a table of tables in Lua. One such example nested table is below.
tabl = {2.0={amount=281.0, meta=0.0, displayName=Dirt, name=minecraft:dirt}, 3.0={amount=190103.0, meta=0.0, displayName=Cobblestone, name=minecraft:cobblestone}, ...}
I would like to go through and return a table of the top ten tabl[*]['amount']
listed with their respective tabl[*]['displayName']
* being a wildcard for tabl[1.0]
through tabl[max.0]
A finished table should look something like:
sorted = {1={displayName=Cobblestone, amount=190103}, 2={displayName=Dirt, amount=281}, ...}
I hope this makes sense to all out there.
Link to full nested table: Full Piece
FYI: I am not in control of how the table is returned to me; I got them from the function listItems()
in this API.