To give some feedback, I think it’d be more user-friendly to use dictionaries - then you have a better idea of what information you’re actually accessing, by doing something like periodicTable[5].Name
instead of periodicTable[5][3]
I’ve tried changing your table a bit and adding some missing entries to it - and more than just that, you can also find information about atoms given their symbol or name using a simple metatable
Obviously there’s a lot more data that could be supplied here, though.
Module code
return setmetatable({
{Number = 1, Symbol = 'H', Name = 'Hydrogen', StdWeight = 1.00794, Period = 1, Group = 1, IsGas = true},
{Number = 2, Symbol = 'He', Name = 'Helium', StdWeight = 4.003, Period = 1, Group = 18, IsGas = true},
{Number = 3, Symbol = 'Li', Name = 'Lithium', StdWeight = 6.941, Period = 2, Group = 1},
{Number = 4, Symbol = 'Be', Name = 'Beryllium', StdWeight = 9.012182, Period = 2, Group = 2},
{Number = 5, Symbol = 'B', Name = 'Boron', StdWeight = 10.811, Period = 2, Group = 13},
{Number = 6, Symbol = 'C', Name = 'Carbon', StdWeight = 12.0107, Period = 2, Group = 14, IsGas = true},
{Number = 7, Symbol = 'N', Name = 'Nitrogen', StdWeight = 14.00674, Period = 2, Group = 15, IsGas = true},
{Number = 8, Symbol = 'O', Name = 'Oxygen', StdWeight = 15.9994, Period = 2, Group = 16, IsGas = true},
{Number = 9, Symbol = 'F', Name = 'Fluorine', StdWeight = 18.9984032, Period = 2, Group = 17, IsGas = true},
{Number = 10, Symbol = 'Ne', Name = 'Neon', StdWeight = 20.1797, Period = 3, Group = 18, IsGas = true},
{Number = 11, Symbol = 'Na', Name = 'Sodium', StdWeight = 22.98977, Period = 3, Group = 1},
{Number = 12, Symbol = 'Mg', Name = 'Magnesium', StdWeight = 24.305, Period = 3, Group = 2},
{Number = 13, Symbol = 'Al', Name = 'Aluminum', StdWeight = 26.981538, Period = 3, Group = 13},
{Number = 14, Symbol = 'Si', Name = 'Silicon', StdWeight = 28.0855, Period = 3, Group = 14},
{Number = 15, Symbol = 'P', Name = 'Phosphorus', StdWeight = 30.973761, Period = 3, Group = 15, IsGas = true},
{Number = 16, Symbol = 'S', Name = 'Sulfur', StdWeight = 32.066, Period = 3, Group = 16, IsGas = true},
{Number = 17, Symbol = 'Cl', Name = 'Chlorine', StdWeight = 35.4527, Period = 3, Group = 17, IsGas = true},
{Number = 18, Symbol = 'Ar', Name = 'Argon', StdWeight = 39.948, Period = 4, Group = 18, IsGas = true},
{Number = 19, Symbol = 'K', Name = 'Potassium', StdWeight = 39.0983, Period = 4, Group = 1},
{Number = 20, Symbol = 'Ca', Name = 'Calcium', StdWeight = 40.078, Period = 4, Group = 2},
{Number = 21, Symbol = 'Sc', Name = 'Scandium', StdWeight = 44.95591, Period = 4, Group = 3},
{Number = 22, Symbol = 'Ti', Name = 'Titanium', StdWeight = 47.867, Period = 4, Group = 4},
{Number = 23, Symbol = 'V', Name = 'Vanadium', StdWeight = 50.9415, Period = 4, Group = 5},
{Number = 24, Symbol = 'Cr', Name = 'Chromium', StdWeight = 51.9961, Period = 4, Group = 6},
{Number = 25, Symbol = 'Mn', Name = 'Manganese', StdWeight = 54.938049, Period = 4, Group = 7},
{Number = 26, Symbol = 'Fe', Name = 'Iron', StdWeight = 55.845, Period = 4, Group = 8},
{Number = 27, Symbol = 'Co', Name = 'Cobalt', StdWeight = 58.9332, Period = 4, Group = 9},
{Number = 28, Symbol = 'Ni', Name = 'Nickel', StdWeight = 58.6934, Period = 4, Group = 10},
{Number = 29, Symbol = 'Cu', Name = 'Copper', StdWeight = 63.546, Period = 4, Group = 11},
{Number = 30, Symbol = 'Zn', Name = 'Zinc', StdWeight = 65.39, Period = 4, Group = 12},
{Number = 31, Symbol = 'Ga', Name = 'Gallium', StdWeight = 69.723, Period = 4, Group = 13},
{Number = 32, Symbol = 'Ge', Name = 'Germanium', StdWeight = 72.61, Period = 4, Group = 14},
{Number = 33, Symbol = 'As', Name = 'Arsenic', StdWeight = 74.9216, Period = 4, Group = 15},
{Number = 34, Symbol = 'Se', Name = 'Selenium', StdWeight = 78.96, Period = 4, Group = 16, IsGas = true},
{Number = 35, Symbol = 'Br', Name = 'Bromine', StdWeight = 79.904, Period = 4, Group = 17, IsGas = true},
{Number = 36, Symbol = 'Kr', Name = 'Krypton', StdWeight = 83.8, Period = 4, Group = 18, IsGas = true},
{Number = 37, Symbol = 'Rb', Name = 'Rubidium', StdWeight = 85.4678, Period = 5, Group = 1},
{Number = 38, Symbol = 'Sr', Name = 'Strontium', StdWeight = 87.62, Period = 5, Group = 2},
{Number = 39, Symbol = 'Y', Name = 'Yttrium', StdWeight = 88.90585, Period = 5, Group = 3},
{Number = 40, Symbol = 'Zr', Name = 'Zirconium', StdWeight = 91.224, Period = 5, Group = 4},
{Number = 41, Symbol = 'Nb', Name = 'Niobium', StdWeight = 92.90638, Period = 5, Group = 5},
{Number = 42, Symbol = 'Mo', Name = 'Molybdenum', StdWeight = 95.94, Period = 5, Group = 6},
{Number = 43, Symbol = 'Tc', Name = 'Technetium', StdWeight = 98, Period = 5, Group = 7},
{Number = 44, Symbol = 'Ru', Name = 'Ruthenium', StdWeight = 101.07, Period = 5, Group = 8},
{Number = 45, Symbol = 'Rh', Name = 'Rhodium', StdWeight = 102.9055, Period = 5, Group = 9},
{Number = 46, Symbol = 'Pd', Name = 'Palladium', StdWeight = 106.42, Period = 5, Group = 10},
{Number = 47, Symbol = 'Ag', Name = 'Silver', StdWeight = 107.8682, Period = 5, Group = 11},
{Number = 48, Symbol = 'Cd', Name = 'Cadmium', StdWeight = 112.411, Period = 5, Group = 12},
{Number = 49, Symbol = 'In', Name = 'Indium', StdWeight = 114.818, Period = 5, Group = 13},
{Number = 50, Symbol = 'Sn', Name = 'Tin', StdWeight = 118.71, Period = 5, Group = 14},
{Number = 51, Symbol = 'Sb', Name = 'Antimony', StdWeight = 121.76, Period = 5, Group = 15},
{Number = 52, Symbol = 'Te', Name = 'Tellurium', StdWeight = 127.6, Period = 5, Group = 16},
{Number = 53, Symbol = 'I', Name = 'Iodine', StdWeight = 126.90447, Period = 5, Group = 17, IsGas = true},
{Number = 54, Symbol = 'Xe', Name = 'Xenon', StdWeight = 131.29, Period = 5, Group = 18, IsGas = true},
{Number = 55, Symbol = 'Cs', Name = 'Caesium', StdWeight = 132.90545, Period = 6, Group = 1},
{Number = 56, Symbol = 'Ba', Name = 'Barium', StdWeight = 137.327, Period = 6, Group = 2},
{Number = 57, Symbol = 'La', Name = 'Lanthanum', StdWeight = 138.9055, Period = 6, Group = 3},
{Number = 58, Symbol = 'Ce', Name = 'Cerium', StdWeight = 140.116, Period = 6, Group = 3},
{Number = 59, Symbol = 'Pr', Name = 'Praseodymium', StdWeight = 140.907, Period = 6, Group = 3},
{Number = 60, Symbol = 'Nd', Name = 'Neodymium', StdWeight = 144.242, Period = 6, Group = 3},
{Number = 61, Symbol = 'Pm', Name = 'Promethium', StdWeight = 145, Period = 6, Group = 3},
{Number = 62, Symbol = 'Sm', Name = 'Samarium', StdWeight = 150.36, Period = 6, Group = 3},
{Number = 63, Symbol = 'Eu', Name = 'Europium', StdWeight = 151.964, Period = 6, Group = 3},
{Number = 64, Symbol = 'Gd', Name = 'Gadolinium', StdWeight = 157.25, Period = 6, Group = 3},
{Number = 65, Symbol = 'Tb', Name = 'Terbium', StdWeight = 158.925, Period = 6, Group = 3},
{Number = 66, Symbol = 'Dy', Name = 'Dysprosium', StdWeight = 162.5, Period = 6, Group = 3},
{Number = 67, Symbol = 'Ho', Name = 'Holmium', StdWeight = 164.930, Period = 6, Group = 3},
{Number = 68, Symbol = 'Er', Name = 'Erbium', StdWeight = 167.259, Period = 6, Group = 3},
{Number = 69, Symbol = 'Tm', Name = 'Thulium', StdWeight = 168.934, Period = 6, Group = 3},
{Number = 70, Symbol = 'Yb', Name = 'Ytterbium', StdWeight = 173.045, Period = 6, Group = 3},
{Number = 71, Symbol = 'Lu', Name = 'Lutetium', StdWeight = 174.9668, Period = 6, Group = 3},
{Number = 72, Symbol = 'Hf', Name = 'Hafnium', StdWeight = 178.49, Period = 6, Group = 4},
{Number = 73, Symbol = 'Ta', Name = 'Tantalum', StdWeight = 180.9479, Period = 6, Group = 5},
{Number = 74, Symbol = 'W', Name = 'Tungsten', StdWeight = 183.84, Period = 6, Group = 6},
{Number = 75, Symbol = 'Re', Name = 'Rhenium', StdWeight = 186.207, Period = 6, Group = 7},
{Number = 76, Symbol = 'Os', Name = 'Osmium', StdWeight = 190.23, Period = 6, Group = 8},
{Number = 77, Symbol = 'Ir', Name = 'Iridium', StdWeight = 192.217, Period = 6, Group = 9},
{Number = 78, Symbol = 'Pt', Name = 'Platinum', StdWeight = 195.078, Period = 6, Group = 10},
{Number = 79, Symbol = 'Au', Name = 'Gold', StdWeight = 196.96655, Period = 6, Group = 11},
{Number = 80, Symbol = 'Hg', Name = 'Mercury', StdWeight = 200.59, Period = 6, Group = 12},
{Number = 81, Symbol = 'Tl', Name = 'Thallium', StdWeight = 204.3833, Period = 6, Group = 13},
{Number = 82, Symbol = 'Pb', Name = 'Lead', StdWeight = 207.2, Period = 6, Group = 14},
{Number = 83, Symbol = 'Bi', Name = 'Bismuth', StdWeight = 208.98038, Period = 6, Group = 15},
{Number = 84, Symbol = 'Po', Name = 'Polonium', StdWeight = 209, Period = 6, Group = 16},
{Number = 85, Symbol = 'At', Name = 'Astatine', StdWeight = 210, Period = 6, Group = 17},
{Number = 86, Symbol = 'Rn', Name = 'Radon', StdWeight = 222, Period = 6, Group = 18, IsGas = true},
{Number = 87, Symbol = 'Fr', Name = 'Francium', StdWeight = 223, Period = 7, Group = 1},
{Number = 88, Symbol = 'Ra', Name = 'Radium', StdWeight = 226, Period = 7, Group = 2},
{Number = 89, Symbol = 'Ac', Name = 'Actinium', StdWeight = 227, Period = 7, Group = 3},
{Number = 90, Symbol = 'Th', Name = 'Thorium', StdWeight = 232.0377, Period = 7, Group = 3},
{Number = 91, Symbol = 'Pa', Name = 'Protactinium', StdWeight = 231.035, Period = 7, Group = 3},
{Number = 92, Symbol = 'U', Name = 'Uranium', StdWeight = 238.028, Period = 7, Group = 3},
{Number = 93, Symbol = 'Np', Name = 'Neptunium', StdWeight = 237, Period = 7, Group = 3},
{Number = 94, Symbol = 'Pu', Name = 'Plutonium', StdWeight = 244, Period = 7, Group = 3},
{Number = 95, Symbol = 'Am', Name = 'Americium', StdWeight = 243, Period = 7, Group = 3},
{Number = 96, Symbol = 'Cm', Name = 'Curium', StdWeight = 247, Period = 7, Group = 3},
{Number = 97, Symbol = 'Bk', Name = 'Berkelium', StdWeight = 247, Period = 7, Group = 3},
{Number = 98, Symbol = 'Cf', Name = 'Californium', StdWeight = 251, Period = 7, Group = 3},
{Number = 99, Symbol = 'Es', Name = 'Einsteinium', StdWeight = 252, Period = 7, Group = 3},
{Number = 100, Symbol = 'Fm', Name = 'Fermium', StdWeight = 257, Period = 7, Group = 3},
{Number = 101, Symbol = 'Md', Name = 'Mendelevium', StdWeight = 258, Period = 7, Group = 3},
{Number = 102, Symbol = 'No', Name = 'Nobelium', StdWeight = 259, Period = 7, Group = 3},
{Number = 103, Symbol = 'Lr', Name = 'Lawrencium', StdWeight = 266, Period = 7, Group = 3},
{Number = 104, Symbol = 'Rf', Name = 'Rutherfordium', StdWeight = 267, Period = 7, Group = 4},
{Number = 105, Symbol = 'Db', Name = 'Dubnium', StdWeight = 268, Period = 7, Group = 5},
{Number = 106, Symbol = 'Sg', Name = 'Seaborgium', StdWeight = 269, Period = 7, Group = 6},
{Number = 107, Symbol = 'Bh', Name = 'Bohrium', StdWeight = 270, Period = 7, Group = 7},
{Number = 108, Symbol = 'Hs', Name = 'Hassium', StdWeight = 270, Period = 7, Group = 8},
{Number = 109, Symbol = 'Mt', Name = 'Meitnerium', StdWeight = 278, Period = 7, Group = 9},
{Number = 110, Symbol = 'Ds', Name = 'Darmstadtium', StdWeight = 281, Period = 7, Group = 10},
{Number = 111, Symbol = 'Rg', Name = 'Roentgenium', StdWeight = 282, Period = 7, Group = 11},
{Number = 112, Symbol = 'Cn', Name = 'Copernicium', StdWeight = 285, Period = 7, Group = 12},
{Number = 113, Symbol = 'Nh', Name = 'Nihonium', StdWeight = 286, Period = 7, Group = 13},
{Number = 114, Symbol = 'Fl', Name = 'Flevorium', StdWeight = 289, Period = 7, Group = 14},
{Number = 115, Symbol = 'Mc', Name = 'Moscovium', StdWeight = 290, Period = 7, Group = 15},
{Number = 116, Symbol = 'Lv', Name = 'Livermorium', StdWeight = 293, Period = 7, Group = 16},
{Number = 117, Symbol = 'Ts', Name = 'Tennessine', StdWeight = 294, Period = 7, Group = 17},
{Number = 118, Symbol = 'Og', Name = 'Oganesson', StdWeight = 294, Period = 7, Group = 18}
}, {
__index = function(tabl, key)
if type(key) == "string" then
for i = 1, #tabl do
if (tabl[i].Symbol == key or tabl[i].Name == key) then
return tabl[i]
end
end
end
end
})
Example of usage:
local PeriodicTable = require(modulescript)
print(PeriodicTable["Au"].Name) -- Gold
print(PeriodicTable["Plutonium"].Period) -- 7
print(PeriodicTable[28].StdWeight) -- 58.6934, check Nickel