Module:Route

local p = {}

function p.route(frame)

frame = frame:getParent.args

local dir = frame['dir'] local clear = frame['clear'] local sclear = frame['sclear']

local route = '{|class="wikitable" style="width: 100%;"\n'

if dir and dir ~= '' then route = route .. '!colspan="5"|' .. dir .. ' route \n|-\n' end

route = route .. '!width="5%"|Order\n!width="25%"|Opponent\n!width="5%"|Level\n!colspan="2" width="65%"|Drop items\n'

local args = 0 for i, v in ipairs(frame) do       args = args + 1 end

for i = 1, args, 4 do       if frame[i] and frame[i + 1] and frame[i + 2] and frame[i + 3] then route = route .. '|-\n|' .. frame[i] .. '\n|' .. frame[i + 1] .. '\n|' .. frame[i + 2] .. '\n|colspan="2"|' .. frame[i + 3] .. '\n' end end

route = route .. '|-\n!colspan="3" rowspan="2"|Treasure chests\n!width="15%"|Normal\n|' .. clear .. '\n|-\n!width="15%"|S clear\n|' .. sclear .. '\n|}'

return route

end

return p