Module:Game Credits
Jump to navigation
Jump to search
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 head = ""
local split = frame.args[2]
local bg = frame:getParent().args["bg"] or Game -- Default value
local bg2 = frame:getParent().args["bg2"] or "Game2" -- Default value
local i = frame.args[1]
while frame:getParent().args["name" .. i] ~= nil and frame:getParent().args["role" .. i] ~= nil or frame:getParent().args["head" .. i] ~= nil do
if frame:getParent().args["head" .. i] ~= nil then
head = frame:getParent().args["head" .. i]
output = output + frame:expandTemplate{ title = "Row", args = {
"'''" .. head .. "'''",
bg1 = bg,
border = "#3f3e3e54",
w1 = "100%",
Image = "True"
}}
end
if frame:getParent().args["name" .. i] ~= nil then
role = frame:getParent().args["role" .. i]
rolejp = preDefinedRoles[role] and preDefinedRoles[role][2] or frame:getParent().args["rolejp" .. i] or ""
role = preDefinedRoles[role] and preDefinedRoles[role][1] or role
if rolejp ~= "" then
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"
}}
end
if i == tonumber(split) then
break;
end
i = i + 1
end
return frame:preprocess(output)
end
return p