Module:Academy

local academy = mw.loadData('Module:Academy/data') local towers = mw.loadData('Module:Academy/towers') local f = require("Module:Functions") local p = {}

function p.list local data = {} for i, j in pairs(academy) do        if j.towers ~= nil then table.insert(data, "=="..i.."==") table.insert(data,'{| class="wikitable" style="text-align: center; width: 100%"') table.insert(data,'|-') table.insert(data,'! rowspan=2 |Name') table.insert(data,'! rowspan=2 |Description') table.insert(data,'! colspan=3 |Skills') table.insert(data,'|-') table.insert(data,'! Name') table.insert(data,'! LvL') table.insert(data,'! Description') table.insert(data,'|-') for a, b in pairs(j.towers) do               tower = towers[b] skilldata = {} if tower.skill ~= nil then r = 1 table.insert(skilldata,'|-') skills = f.split(tower.skill,";") desc = f.split(tower.skilldesc,";") for e, s in pairs(skills) do                       upgrades = f.split(desc[e],",") table.insert(skilldata,"| rowspan= "..#upgrades..'| "..s.."")                        r=r+#upgrades                        for g in f.range(#upgrades) do                            table.insert(skilldata,"|"..g)                            table.insert(skilldata,"|"..upgrades[g])                            table.insert(skilldata,'|-')                        end                        table.insert(skilldata,'|-')                    end                else table.insert(skilldata,"|colspan=3 | /") r = 1 end                mw.log(r)                table.insert(data,"| rowspan="..r..' |  "..b.."") table.insert(data,"| rowspan="..r.." |"..tower.desc) table.insert(data, table.concat(skilldata, "\n")) table.insert(data,'|-') end table.insert(data, '|}') end end for i, j in pairs(data) do mw.log(j) end return table.concat(data, "\n") end

return p