Module:CharacterFilters

-- Lua Template for Dynamic Character filter controls local p = {}

local common = require('Module:Common') local data = mw.loadData('Module:Character/Data')

local button = ' %s '

-- Get multi-select groups for Affiliation and Names function p.SelectGroups return ' '.. UniqueOptions('affiliation').. ' '..          ' '..              UniqueOptions('name').. ' ' end

-- Return each unique value of a given field as a button option function UniqueOptions(field) local buttons = {} local unique = {} for id, charData in common.sortedPairs(data) do       local value = charData[field] if value and not unique[value] then unique[value] = true buttons[#buttons+1] = string.format(button, value, value, value) end end return table.concat(buttons) end

return p