weaknesss nil handling

This commit is contained in:
Chr1Z93 2024-08-06 19:14:57 +02:00
parent d4a20a292f
commit 10c759e56e

View File

@ -291,8 +291,12 @@ function cardComparator(id1, id2)
local card1 = cardIdIndex[id1]
local card2 = cardIdIndex[id2]
if card1.metadata.level ~= card2.metadata.level then
return card1.metadata.level < card2.metadata.level
-- get level per card (use 6 to sort cards last without level)
local level1 = card1.metadata.level or 6
local level2 = card2.metadata.level or 6
if level1 ~= level2 then
return level1 < level2
elseif card1.data.Nickname ~= card2.data.Nickname then
return card1.data.Nickname < card2.data.Nickname
else