Since line 1 is blank I assume everything just got shifted down by 1 line when you pasted, and the error is coming from this:
Code:
return a.priority < b.priority or a.priority==b.priority and a.name < b.name
If you're sure all the subtables in your spells table have a
priority key, then the issue is probably with spells that don't exist anymore (or yet). I'd just remove them from the table in the previous block:
Code:
-- get info
for i = #cfg.spells, 1, -1 do
local spell = cfg.spells[i]
spell.name = GetSpellInfo(spell.id)
if not spell.name then
print("Spell", spell.id, "doesn't exist!")
tremove(cfg.spells, i)
end
end
Note the reversed iteration order for the loop; this is important since otherwise removing indices inside the loop will cause some entries to be skipped as the indices shift.