Module:Data tables/common: Difference between revisions
Jump to navigation
Jump to search
add common headers |
changed to table concat format |
||
(One intermediate revision by the same user not shown) | |||
Line 10: | Line 10: | ||
"!Impact Tolerance (m/s)\n" | "!Impact Tolerance (m/s)\n" | ||
end | end | ||
--function p.commonCells(partJson) | |||
--local commonCells = "|-\n" .. | |||
-- "|".."[[File:"..partJson["file"].."|80px|center]]\n" .. | |||
-- "|".."[["..partJson["name"].."]]\n" .. | |||
-- "|".."{{Size|Size="..partJson["size"].."}}\n" .. | |||
-- "|"..partJson["mass"].."\n" .. | |||
-- "|"..partJson["max_temp"].."\n" .. | |||
-- "|"..partJson["imp_tol"].."\n" | |||
--return commonCells | |||
--end | |||
function p.commonCells(partJson) | function p.commonCells(partJson) | ||
local commonCells = "|-\n" . | local commonCells = {"|-\n"} | ||
table.insert(commonCells, "|".."[[File:"..partJson["file"].."|80px|center]]\n") | |||
table.insert(commonCells, "|".."[["..partJson["name"].."]]\n") | |||
table.insert(commonCells, "|".."{{Size|Size="..partJson["size"].."}}\n") | |||
table.insert(commonCells, "|"..partJson["mass"].."\n") | |||
table.insert(commonCells, "|"..partJson["max_temp"].."\n") | |||
table.insert(commonCells, "|"..partJson["imp_tol"].."\n") | |||
return commonCells | return table.concat(commonCells) | ||
end | end | ||
return p | return p |
Latest revision as of 04:42, 7 March 2025
Documentation for this module may be created at Module:Data tables/common/doc
local p = {}
function p.commonHeaders()
return "{| class=\"wikitable sortable\" style=\"text-align: center\"\n" ..
"!Image\n" ..
"!Name\n" ..
"!Size\n" ..
"!Mass (t)\n" ..
"!Max Temperature (K)\n" ..
"!Impact Tolerance (m/s)\n"
end
--function p.commonCells(partJson)
--local commonCells = "|-\n" ..
-- "|".."[[File:"..partJson["file"].."|80px|center]]\n" ..
-- "|".."[["..partJson["name"].."]]\n" ..
-- "|".."{{Size|Size="..partJson["size"].."}}\n" ..
-- "|"..partJson["mass"].."\n" ..
-- "|"..partJson["max_temp"].."\n" ..
-- "|"..partJson["imp_tol"].."\n"
--return commonCells
--end
function p.commonCells(partJson)
local commonCells = {"|-\n"}
table.insert(commonCells, "|".."[[File:"..partJson["file"].."|80px|center]]\n")
table.insert(commonCells, "|".."[["..partJson["name"].."]]\n")
table.insert(commonCells, "|".."{{Size|Size="..partJson["size"].."}}\n")
table.insert(commonCells, "|"..partJson["mass"].."\n")
table.insert(commonCells, "|"..partJson["max_temp"].."\n")
table.insert(commonCells, "|"..partJson["imp_tol"].."\n")
return table.concat(commonCells)
end
return p