Module:Variants: Difference between revisions

Fix error when no variant smw data exists, and add tracking category
(Created page with "local p = {} function sort_entries(entry1, entry2) -- Sort the variants based on the sum of the profession levels local entry1_value = (entry1['Profession Level A'] or 0) + (entry1['Profession Level B'] or 0) local entry2_value = (entry2['Profession Level A'] or 0) + (entry2['Profession Level B'] or 0) return entry1_value < entry2_value end function format_entry(entry) -- Format the search result as Page. At the moment, don't include profession data in the tab...")
 
(Fix error when no variant smw data exists, and add tracking category)
 
(6 intermediate revisions by one other user not shown)
Line 25:
}
local smw_data = mw.smw.ask(query)
if not smw_data then
return {'[[Category:Empty variant list]]'}
end
table.sort(smw_data, sort_entries)
local table_contents = {}
Line 42 ⟶ 45:
function p.main(frame)
local args = frame:getParent().args
args.variant = args[1] or args.variant
return p.variant_table(args)
end