Listing parts by magnitude?

Okay so say I have TableA, and PartB.
I want to:

  1. Take all parts in TableA and list their magnitudes to PartB
  2. List the magnitudes in a dictionary
  3. Sort the dictionary by the magnitudes

So I know how magnitude works, the problem is I’m not as sure as how table.sort works.
How could I use table.sort to sort the dictionary from parts in TableA.
(No, I haven’t any script for this yet, it’s a general idea and I’m the kind that likes to thoroughly plan things through. It’s kinda a bad thing at some points though, so I’m trying to break the habit so I can be a little more loose.)

ON SECOND THOUGHT
I think I just figured the sort function out, sorry for taking up space ^-^