Module:Game Credits: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
local preDefinedRoles = mw.loadData( 'Module:Game Credits/roles' ) |
|||
function p.main(frame) |
function p.main(frame) |
||
Line 13: | Line 15: | ||
local i = 1 |
local i = 1 |
||
while frame:getParent().args["name" .. i] ~= nil do |
while frame:getParent().args["name" .. i] ~= nil or frame:getParent().args["role" .. i] ~= nil do |
||
role = frame:getParent().args["role" .. i] |
role = frame:getParent().args["role" .. i] |
||
role = preDefinedRoles[role][1] or role |
|||
rolejp = frame:getParent().args["rolejp" .. i] |
rolejp = preDefinedRoles[role][2] or frame:getParent().args["rolejp" .. i] |
||
if rolejp == nil then |
if rolejp == nil then |
||
rolejp = "" |
rolejp = "" |
||
Line 21: | Line 24: | ||
rolejp = " {{S|" .. rolejp .. "}}" |
rolejp = " {{S|" .. rolejp .. "}}" |
||
end |
end |
||
name = frame:getParent().args["name" .. i] |
name = frame:getParent().args["name" .. i] |
||
output = output .. frame:expandTemplate{ title = "Row", args = { |
output = output .. frame:expandTemplate{ title = "Row", args = { |
||
"'''" .. role .. "'''" .. rolejp, |
"'''" .. role .. "'''" .. rolejp, |
Revision as of 16:19, 13 January 2024
Documentation for this module may be created at Module:Game Credits/doc
local p = {}
local preDefinedRoles = mw.loadData( 'Module:Game Credits/roles' )
function p.main(frame)
local output = ""
local role = ""
local rolejp = ""
local name = ""
local bg2 = frame:getParent().args["bg2"]
if bg2 == nil then
bg2 = "Game2" -- Default value
end
local i = 1
while frame:getParent().args["name" .. i] ~= nil or frame:getParent().args["role" .. i] ~= nil do
role = frame:getParent().args["role" .. i]
role = preDefinedRoles[role][1] or role
rolejp = preDefinedRoles[role][2] or frame:getParent().args["rolejp" .. i]
if rolejp == nil then
rolejp = ""
else
rolejp = " {{S|" .. rolejp .. "}}"
end
name = frame:getParent().args["name" .. i]
output = output .. frame:expandTemplate{ title = "Row", args = {
"'''" .. role .. "'''" .. rolejp,
name,
bg1 = bg2,
border = "#3f3e3e54",
w1 = "15%",
Image = "True"
}}
i = i + 1
end
return frame:preprocess(output)
end
return p