Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:Calc
(view source)
Revision as of 10:02, 2 November 2021
95 bytes added
,
3 years ago
no edit summary
Line 439:
Line 439:
if args.sort and sequence and not sorted then
if args.sort and sequence and not sorted then
sorted = true
sorted = true
+
local sorts = mw.text.split(args.sort, "%s*,%s*")
table.sort(sequence, function(a, b)
table.sort(sequence, function(a, b)
local a = Ship(a)
local a = Ship(a)
local b = Ship(b)
local b = Ship(b)
−
local x = a[
args.
sort](a)
+
for _, sort in ipairs(sorts) do
−
local y = b[
args.
sort](b)
+
local x = a[sort](a)
−
if x < y then return true
+
local y = b[sort](b)
−
elseif
x
==
y then return
a:sort_id() < b:sort_id()
+
if x < y then return true
end
−
else
return false
end
+
if
x
>
y then return
false end
+
end
+
return false
end)
end)
end
end
がか
cssedit, gkautomate
7,064
edits