Module:Sandbox/OmarKMu

p = {}

local function split(s, c)   c = c and c or ',' local t = {} for v in s:gmatch("[^"..c.."]+") do       t[#t + 1] = v:match('^%s*(.*%S)') end return t end local function buildRows(t, c, n, f)   n = n or '\n' f = f or '|-' local s = ''

for _, v in next, t do s = s..n..c..v end if f then s = s..n..f end

return s end local function buildHeadings(t) return buildRows(t, '!', '\n', '|-') end function p.createTable(frame) local headings = frame.args['headings'] local class = frame.args['class'] or 'article-table' headings = headings and buildHeadings(split(tostring(headings))) or '' local rows = {} for _, v in ipairs(frame.args) do       local inlineRows = split(tostring(v), ';') local rowT = {} for _, s in next, inlineRows do           rows[#rows + 1] = split(tostring(s)) end end local rowStr = '' for _, v in next, rows do rowStr = rowStr..buildRows(v, '|', '\n', '|-') end local values = '' return '{| class = "'..class..'"'..headings..rowStr..'|}' end

return p