Difference between revisions of "Module:Tables"

Jump to navigation Jump to search
79 bytes added ,  11:32, 14 August 2022
no edit summary
(Created page with "local com = require('Module:Common') local a = require('Module:Args') local i = require('Module:Icon') local p = {} function p.buildings(frame) local buildingList = mw.load('Module:Buildings') local args = a.getArgs(frame) local buildingTable = mw.html.create('table') buildingTable:addClass('wikitable sortable') :tag('tr') :tag('th') :wikitext('Name') :done() :tag('th') :wikitext('Prerequisites')...")
 
Line 8: Line 8:
local args = a.getArgs(frame)
local args = a.getArgs(frame)
local buildingTable = mw.html.create('table')
local buildingTable = mw.html.create('table')
local dataTable = {}
for k, v in pairs(buildingList) do
if v.group == args['group'] or not args['group'] then
table.insert(dataTable, k)
end
end
table.sort(dataTable)
buildingTable:addClass('wikitable sortable')
buildingTable:addClass('wikitable sortable')
    :tag('tr')
:tag('tr')
        :tag('th')
:tag('th')
            :wikitext('Name')
:wikitext('Name')
            :done()
:done()
        :tag('th')
:tag('th')
            :wikitext('Prerequisites')
:wikitext('Prerequisites')
            :done()
:done()
        :tag('th')
:tag('th')
            :wikitext('Production')
:wikitext('Production')
            :done()
:done()
        :tag('th')
:tag('th')
            :wikitext('Construction Requirements')
:wikitext('Construction Requirements')
            :done()
:done()
        :done()
:done()
 
end
end

Navigation menu