Module:Live song counter: Difference between revisions

From Weezerpedia
No edit summary
No edit summary
Tag: Reverted
Line 10: Line 10:
      
      
     -- Loop through each argument and add it to the table
     -- Loop through each argument and add it to the table
     for _, song in ipairs(args) do
     for i, song in ipairs(args) do
         output = output .. '\n|-\n| ' .. song  -- Add a row for each song
         -- Only process non-empty values
        if song and song ~= "" then
            output = output .. '\n|-\n| ' .. song  -- Add a row for each song
        end
     end
     end
      
      

Revision as of 16:41, 7 April 2025

Documentation for this module may be created at Module:Live song counter/doc

local p = {}

function p.main(frame)
    -- Get all the song names from the parameters
    local args = frame.args
    
    -- Start the table output
    local output = '{| class="wikitable"'
    output = output .. '\n! Song'  -- Table header
    
    -- Loop through each argument and add it to the table
    for i, song in ipairs(args) do
        -- Only process non-empty values
        if song and song ~= "" then
            output = output .. '\n|-\n| ' .. song  -- Add a row for each song
        end
    end
    
    -- End the table
    output = output .. '\n|}'
    
    -- Return the generated table
    return output
end

return p