Module:TableGenerator: Difference between revisions

Sur (talk | contribs)
m Undo revision 5291 by Sur (talk)
Tag: Undo
Sur (talk | contribs)
m only color slightly darker if class is Statbox_hero
Line 13: Line 13:
     local cols = tonumber(args['cols']) or 3  -- Default number of columns is 3
     local cols = tonumber(args['cols']) or 3  -- Default number of columns is 3
     local onlyBody = args['onlyBody'] == 'true'  -- Check if onlyBody is set to true
     local onlyBody = args['onlyBody'] == 'true'  -- Check if onlyBody is set to true
    local class_is_statbox = args['class'] == 'Statbox_hero'
     local cell_values = args['cell_values'] or ""  -- Get the cell values argument
     local cell_values = args['cell_values'] or ""  -- Get the cell values argument
     local values = {}  -- Table to hold the individual cell values
     local values = {}  -- Table to hold the individual cell values
Line 40: Line 41:
         -- If the value contains a " 0 " then it will be colored slightly darker
         -- If the value contains a " 0 " then it will be colored slightly darker
         local class = ''
         local class = ''
         if value:find(" 0[^%.]") then
         if (class_is_statbox) then
            class = ' class="darker"'
        if value:find(" 0[^%.]") then
        end
            class = ' class="darker"'
        end
    end


         -- Add the value as a table cell with the appropriate class
         -- Add the value as a table cell with the appropriate class