Module:Sandbox/ChaoticShadow/SongDataLine: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 45: | Line 45: | ||
end |
end |
||
return tostring(root) .. mw.dumpObject(tbls) .. others .. mw.dumpObject(args) |
return tostring(root) .. mw.dumpObject(tbls) .. others .. mw.dumpObject(args) .. #tbls.jp.tb |
||
end |
end |
||
Revision as of 02:06, 24 June 2021
Documentation for this module may be created at Module:Sandbox/ChaoticShadow/SongDataLine/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
local args = {}
local root = mw.html.create('table'):addClass('wikitable')
local others = ''
function p.main(frame)
args = getArgs(frame)
tbl1 = {}
base1 = 1
tbl2 = {}
tbls = {
jp = {
pattern = "^jp[0-9]+$",
tb = {},
base = 1
},
en = {
pattern = "^en[0-9]+$",
tb = {},
base = 1
}
}
for k,v in pairs(args) do
if string.match(k, "^jp[0-9]+$") then
ind = tonumber(string.match(k, "[0-9]+"))
if ind == tbls.jp.base then
tbls.jp.base = tbls.jp.base + 1
end
tbls.jp.tb[ind] = v
elseif string.match(k, "^en[0-9]+$") then
else
others = others .. k .. ',' .. v .. '\n'
end
end
for i=1,tbls.jp.base-1,1 do
root:tag('tr'):tag('td'):wikitext(tbls.jp.tb[i])
end
return tostring(root) .. mw.dumpObject(tbls) .. others .. mw.dumpObject(args) .. #tbls.jp.tb
end
return p