Module:ValidTypes

-- -- Work in Progress --

leave this stuff alone local p = {} require('Module:StrManip')

valid = {} --

--

--[[ Valid Types for the wiki can be changed here

Changing the types here will affect the Category:Types page, showing a table listing the valid types and subtypes and more importantly The List.

Format: valid["type in quotation marks"] = "subtypes separated by commas and entire thing in quotation marks"

The order of the Types will always be alphabetical, no matter how you manually order them. The order of the SubTypes will always be *as it is written down* this means that valid["TypeA"] "SubType1, SubType2" valid["TypeB"] "SubTypeA, SubTypeB" and valid["TypeB"] "SubTypeA, SubTypeB" valid["TypeA"] "SubType1, SubType2" would result in an identical list.

however valid["TypeA"] "SubType1, SubType2" valid["TypeB"] "SubTypeA, SubTypeB" and valid["TypeB"] "SubTypeB, SubTypeA" valid["TypeA"] "SubType2, SubType1" would result in a list where the Types are in the same order, but the order of the SubTypes is reversed.

--]]

--Change shit between here

valid["Alien"]        = "" valid["Construct"]    = "Celestial, Homunculus, Doll, Familiar, Machine, Object, Organic, Program" valid["Divine"]       = "Angel, Demi Goddess, Deity" valid["Grimoire"]     = "" valid["Heroic Spirit"] = "Servant" valid["Magical"]      = "Magical Girl, Witch, Wizard" valid["Mythological"] = "Dragon, Dwarf, Elf, Fairy, Halfling, Kitsune, Medusa, Oni, Shikigami, Spirit, Youkai" valid["Scientific"]   = "Drug, Genetic" valid["Natural"]      = "" valid["Transcendent"] = "" valid["Undead"]       = "Ghost, Vampire, Zombie" valid["Unknown"]      = ""

--and here

--

valid = {} valid["Undead"] = "Ghost, Vampire, Zombie"

--function p.parse for key, value in next, valid do      local splitSub = strSplit(value,",") for i,sub in ipairs(splitSub) do          splitSub[i] = splitSub[i]:gsub("^%s*(.-)%s*$", "%1") end valid[key] = splitSub end --mw.logObject(valid) --  return(valid) --end

--p.parse

function p.assembleList theList = "" for main,sub in next, valid do       listField = "" --mw.logObject(main) --mw.logObject(main[1]) if (sub[1] == nil) then --mw.logObject(main.." has no subtype") listField = listField .. "|-\n! \n" else listField = listField .. "|-\n| style=\"background:\#17111b;text-align:center;color:\#eee;font-weight:bold;font-size:25px;font-family:'Franklin Gothic';border: 2px solid \#70547c\" colspan=2 | "..main.." \n" for i,s in ipairs(sub) do               listField = listField .. "! \n| style=\"background:#70547c;border: #70547c 2px solid\" |  \n|-\n" end end theList = theList .. listField end mw.logObject(theList) return wikitext(theList)

end

-- ! ! --

return p