Module:TableGenerator: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m only color slightly darker if class is Statbox_hero
Sur (talk | contribs)
m use class if not 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 class = args['class']
    local class_is_statbox = 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_str = ''
         if (class_is_statbox) then
         if (class_is_statbox) then
        if value:find(" 0[^%.]") then
        if value:find(" 0[^%.]") then
            class = ' class="darker"'
            class_str = ' class="darker"'
        end
        end
        else
        class_str = ' class="' .. class .. '"'
     end
     end