Module:ItemTables: Difference between revisions

cleanup unused code, start building table
expand into template
Line 114: Line 114:
createTable:node(createTableRow)
createTable:node(createTableRow)


for internalName, statName in pairs(data) do --statName is the key. go through whole table. in this case itemName can be upgrade_improved_stamina
for internalName, statName in pairs(data) do --statName is the key. go through whole table. in this case itemName can be upgrade_improved_stamina
local display = frame:expandTemplate{
title = 'ItemIcon',
args = {
statName["Name"]
}
}
if(statName[property] ~= nil and statName["Name"] ~= nil) then
if(statName[property] ~= nil and statName["Name"] ~= nil) then
listofItems = listofItems .. statName["Name"] .. "<br/>"
listofItems = listofItems .. statName["Name"] .. "<br/>"
Line 123: Line 131:
local tableData = mw.html.create('tr')
local tableData = mw.html.create('tr')
tableData
tableData
:tag('td'):wikitext(statName["Name"]):done()
:tag('td'):wikitext(display):done()
:tag('td'):wikitext(statName["Cost"]):done()
:tag('td'):wikitext(statName["Cost"]):done()
Line 137: Line 145:
--createTable:node(createTableRow)
--createTable:node(createTableRow)
return tostring(createTable), listofItems
return tostring(createTable), listofItems
--return listofItems --temp replace with line above
--return listofItems -- this is just a string
--return table.concat(TableValues, ", ")
--return table.concat(TableValues, ", ")