Module:descendants: Difference between revisions

Jump to navigation Jump to search
m
Optimisation
mNo edit summary
m (Optimisation)
Line 196: Line 196:
local sorter_bor_proto = {}
local sorter_bor_proto = {}
for key, _ in pairs(tab) do
for key, _ in pairs(tab) do
if mw.ustring.find(key, "%-pro[0-9]*$") then
local is_proto = mw.ustring.find(key, "%-pro[0-9]*$")
if mw.ustring.find(key, "%>[^%>%_%:]+$") then
local is_borrowed = mw.ustring.find(key, "%>[^%>%_%:]+$")
table.insert(sorter_bor_proto, key)
if is_proto then
else
if is_borrowed then table.insert(sorter_bor_proto, key) else table.insert(sorter_proto, key) end
table.insert(sorter_proto, key)
end
else
else
if mw.ustring.find(key, "%>[^%>%_%:]+$") then
if is_borrowed then table.insert(sorter_bor, key) else table.insert(sorter, key) end
table.insert(sorter_bor, key)
else
table.insert(sorter, key)
end
end
end
end
end
Line 220: Line 214:
for _, key in ipairs(sorter) do
for _, key in ipairs(sorter) do
local out = " " .. items[key]
local out = " " .. items[key]
for i = 1, it do
for i = 1, it do out = "*" .. out end -- this asterisk is for list formatting
out = "*" .. out
end
out = indenter .. out
out = indenter .. out
table.insert(outs, out)
table.insert(outs, out)

Navigation menu