Module:Sandbox/ChaoticShadow/SongDataLine: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
(50 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
local p = {} |
local p = {} |
||
local args = {} |
local args = {} |
||
local root = mw.html.create('table'):addClass('wikitable') |
|||
local others = '' |
|||
function p.main(frame) |
function p.main(frame) |
||
args = getArgs(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 mw.text.jsonEncode(args) |
|||
return tostring(root) .. mw.dumpObject(tbls) .. others .. mw.dumpObject(args) .. #tbls.jp.tb |
|||
end |
end |
||
Latest revision as of 04:19, 9 August 2021
Documentation for this module may be created at Module:Sandbox/ChaoticShadow/SongDataLine/doc