Module:TableGenerator: Difference between revisions

Sur (talk | contribs)
mNo edit summary
Sur (talk | contribs)
m removed if i>1
Line 24: Line 24:
     local count = 0
     local count = 0
     for i, value in ipairs(args) do
     for i, value in ipairs(args) do
         -- If the first argument is 'cols', skip it
         -- If it's the start of a new row
        if i > 0 then
        if count % cols == 0 then
            -- If it's the start of a new row
            if count > 0 then
            if count % cols == 0 then
                result = result .. '  </tr>\n'
                if count > 0 then
                    result = result .. '  </tr>\n'
                end
                result = result .. '  <tr>\n'
             end
             end
            result = result .. '  <tr>\n'
        end


            -- Add the value as a table cell
        -- Add the value as a table cell
            result = result .. '    <td>' .. value .. '</td>\n'
        result = result .. '    <td>' .. value .. '</td>\n'
            count = count + 1
        count = count + 1
        end
     end
     end