Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:Iterator
(view source)
Revision as of 00:10, 11 September 2022
36 bytes added
,
2 years ago
m
→Protect against nil sort for unknown ship class, etc.
Line 133:
Line 133:
if sortKey then
if sortKey then
table.sort(collection, function(a, b)
table.sort(collection, function(a, b)
−
if a[sortKey] ~= b[sortKey] then
+
if
a[sortKey] and b[sortKey] and
a[sortKey] ~= b[sortKey] then
return a[sortKey] < b[sortKey]
return a[sortKey] < b[sortKey]
elseif a._id == b._id then
elseif a._id == b._id then
return a._api_id < b._api_id
return a._api_id < b._api_id
−
else
+
else
return a._id < b._id
return a._id < b._id
end
end
Line 438:
Line 438:
end
end
−
testIterator('shipsByType', { type = '
18
', sort = '
_id
' , listBase = true})
+
testIterator('shipsByType', { type = '
11
', sort = '
_class
' , listBase = true})
testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})
testIterator('shipsBy', { pred = 'is_auxiliary' , sort = '_name'})
Memetails
1,025
edits