Module:Sandbox/Frietjes: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
local p = {}
 
function p.datamain(frame)
local status_lettersgetArgs = require('ACDEGHOPQRTXYZModule:Arguments').getArgs
local args = getArgs(frame, {parentFirst = true})
res = ''
for m in mw.text.gsplit(status_letters, '') do
local team_list = {}
res = res .. '+' .. m .. '+'
local ii = 1
while args['team'..ii] ~= nil do
team_list[args['team'..ii]] = ii
ii = ii + 1
end
local max_team = ii - 1
return res
local first_team, last_team = 1, max_team
if args['showteam'] and team_list[args['showteam']] then
first_team = team_list[args['showteam']] - 2
last_team = first_team + 4
if first_team < 1 then
first_team = 1
last_team = first_team + 4
end
if last_team > max_team then
last_team = max_team
first_team = max_team - 4
end
if first_team < 1 then first_team = 1 end
end
local ii = first_team
local res = '{| class="wikitable"\n'
while args['team'..ii] ~= nil and (ii <= last_team) do
res = res .. '+' .. m .. '+|-\n'
res = res .. '| ' .. args['team' .. ii] .. '\n'
res = res .. '| ' .. (args['result'..ii] and args['text_'..args['result'..ii]] or '') .. '\n'
end
return res =.. '|}'
end