2,851
edits
No edit summary |
No edit summary |
||
Line 140: | Line 140: | ||
local rows = { | local rows = { | ||
method = "Biological Age Estimation Method", | {key = "method", name = "Biological Age Estimation Method"}, | ||
year = "Year" | {key = "year", name = "Year"} | ||
} | } | ||
Line 193: | Line 193: | ||
wikitable = wikitable .. '\n' | wikitable = wikitable .. '\n' | ||
for | for i, row in ipairs(rows) do | ||
wikitable = wikitable .. '|-\n' | wikitable = wikitable .. '|-\n' | ||
wikitable = wikitable .. '| ' .. name .. ' || ' .. '' | wikitable = wikitable .. '| ' .. row.name .. ' || ' .. '' | ||
for _, study in pairs(studies) do | for _, study in pairs(studies) do | ||
local cellValue = study[key] or "" | local cellValue = study[row.key] or "" | ||
wikitable = wikitable .. ' || ' .. cellValue | wikitable = wikitable .. ' || ' .. cellValue | ||
end | end | ||
Line 204: | Line 204: | ||
-- Generate rows for each biomarker | -- Generate rows for each biomarker | ||
for i, | for i, bm in ipairs(biomarkers) do | ||
wikitable = wikitable .. '|-\n' | wikitable = wikitable .. '|-\n' | ||
wikitable = wikitable .. '| ' .. | wikitable = wikitable .. '| ' .. bm.system .. ' || ' .. bm.name | ||
for _, study in pairs(studies) do | for _, study in pairs(studies) do | ||
-- Retrieve data value for the current cell, using the nested structure | -- Retrieve data value for the current cell, using the nested structure | ||
local cellValue = study.data[ | local cellValue = study.data[bm.key] or "" | ||
wikitable = wikitable .. ' || ' .. cellValue | wikitable = wikitable .. ' || ' .. cellValue | ||
end | end |