Module:History
From Vintage Story Wiki
Documentation for this module may be created at Module:History/doc
local p = {}
function p.create(f)
local args = require( 'Module:ProcessArgs' ).merge( true )
local header = {
'{|class="wikitable"',
'!colspan="3"|History',
'|-'
}
local footer = '|}'
local mt_2D = {
__index =
function(t, k)
local inner = {}
rawset(t, k, inner)
return inner
end
}
local versions = setmetatable({}, mt_2D)
for i,v in pairs(args) do
local version = string.match(v, '(.*);')
local parent = string.match(version, '(.*)-')
local child = string.match(version, '-(.*)')
local note = string.match(v , ';(.*)')
versions[parent][child] = note
end
local body = table.concat(header, '\n')
for ver in ipairs(versions) do
body = body .. '|[[' .. tostring(ver) .. ']]'
for child in ipairs(ver) do
body = body .. '||[[' .. tostring(child) .. ']]'
for note in ipairs(child) do
body = body .. '||' .. note
end
end
end
return body .. '\n' .. footer
end
return p