I'm absolutely stumped here;

local function sortlist(a, b)
	local colless = a.color == lplayer.TeamColor or a.color.Number < b.color.Number
	local rankless = a.rank == lplrank or a.rank < b.rank
	print("Sort", a.obj, b.obj) -- This is line 14 in the script
	print(colless, rankless)
	return colless and rankless
end

This is the output (with the full script name removed):

17:55:38.960 - script:14: attempt to index local 'b' (a nil value)
17:55:38.961 - Stack Begin
17:55:38.961 - Script 'script', Line 14
17:55:38.962 - Script 'script', Line 20 - global Reorder
17:55:38.963 - Script 'script', Line 49 - global OnPlayerAdded
17:55:38.963 - Script 'script', Line 82
17:55:38.964 - Stack End

My questions are: (A) Why is this not erroring at line 12, where I reference 'b' for the first time in the 'sortlist' function (B) Why is it even erroring at all? I'm running table.sort() with this as the sort function, and last I checked, table.sort guarantees that both args exist.