Module:CharacterSkills

local p = {} local cargo = mw.ext.cargo

function p.List( frame ) local args = frame.args local fieldstable = { "Characters.Name=Cname", "Characters.Skills=Cskills", "Skills.SkillIcon=SkillIcon", "Skills.SkillName=SkillName", "Skills.SkillDescription=SkillDescription", "Skills.SkillType=SkillType", "Skills.ManaCost=ManaCost", "Skills.Cooldown=Cooldown", "Skills.LevelUnlock=LevelUnlock", "Skills.SkillClass=SkillClass", "Skills.SkillDamageTypes=SkillDamageTypes", "Skills.OtherTags=OtherTags", "Skills.BaseDamage=BaseDamage", "Skills.AttackTime=AttackTime", "Skills._pageName=_pageName", }   local tables = 'Characters, Skills' local fields = table.concat(fieldstable,",") -- optional parameters are grouped in one table -- you can omit any or all of them, except joinOn if you use more than one table local cargoquery = { where = args.where, join='Characters.Skills HOLDS Skills.SkillName', orderBy='Characters.Name' }   local result = mw.ext.cargo.query( tables, fields, cargoquery )

if result[1] == nil then return args.default

elseif result[1].Cskills == '' then return args.default

elseif result[1] ~= nil then --Start the table local tbl = mw.html.create('table') tbl:addClass('wikitable sortable mw-datatable') if args.SkillIcon ~= "hide" then tbl:tag("th"):wikitext("Icon"):done end if args.SkillName ~= "hide" then tbl:tag("th"):wikitext("Skill Name"):done end if args.SkillDescription ~= "hide" then tbl:tag("th"):wikitext("Skill Description"):done end if args.SkillType ~= "hide" then tbl:tag("th"):wikitext("Skill Type"):done end if args.ManaCost ~= "hide" then tbl:tag("th"):wikitext("Mana Cost"):done end if args.Cooldown ~= "hide" then tbl:tag("th"):wikitext("Cooldown"):done end if args.LevelUnlock == "show" then tbl:tag("th"):wikitext("Level Unlocked"):done end if args.SkillClass == "show" then tbl:tag("th"):wikitext("Class"):done end if args.SkillDamageTypes == "show" then tbl:tag("th"):wikitext("Damage Type"):done end if args.OtherTags == "show" then tbl:tag("th"):wikitext("Skill Tags"):done end if args.BaseDamage == "show" then tbl:tag("th"):wikitext("Base Damage"):done end if args.AttackTime == "show" then tbl:tag("th"):wikitext("Attack Time"):done end if args.CharacterName == "show" then tbl:tag("th"):wikitext("Character Name"):done end tbl:done --Construct the rows in the table for _,row in ipairs(result) do		tr = tbl:tag("tr") if args.SkillIcon ~= "hide" then tr:tag("td"):wikitext(""):done end if args.SkillName ~= "hide" then tr:tag("td"):wikitext("" .. row.SkillName .. ""):done end if args.SkillDescription ~= "hide" then tr:tag("td"):wikitext(row.SkillDescription):done end if args.SkillType ~= "hide" then tr:tag("td"):wikitext(row.SkillType):done end if args.ManaCost ~= "hide" then tr:tag("td"):wikitext(row.ManaCost):done end if args.Cooldown ~= "hide" then tr:tag("td"):wikitext(row.Cooldown):done end if args.LevelUnlock == "show" then tr:tag("td"):wikitext(row.LevelUnlock):done end if args.SkillClass == "show" then tr:tag("td"):wikitext(row.SkillClass):done end if args.SkillDamageTypes == "show" then tr:tag("td"):wikitext(row.SkillDamageTypes):done end if args.OtherTags == "show" then tr:tag("td"):wikitext(row.OtherTags):done end if args.BaseDamage == "show" then tr:tag("td"):wikitext(row.BaseDamage):done end if args.AttackTime == "show" then tr:tag("td"):wikitext(row.AttackTime):done end if args.CharacterName == "show" then tr:tag("td"):wikitext(row.Cname):done end end return tbl end -- . . . end return p