Module:ModuleLevelTable

From The First Descendant Wiki
Revision as of 03:05, 4 June 2024 by Software2 (talk | contribs)

Documentation for this module may be created at Module:ModuleLevelTable/doc

local p = {}

function p.parseCsv(frame)
    -- Get the CSV string from the template parameter named 'csv'
    local csvString = frame.args[1]

    -- Initialize an empty multidimensional array
    local csvArray = {}

    -- Split the CSV string into lines
    for line in csvString:gmatch("[^\n]+") do
        local row = {}
        -- Split each line into values using a comma as the delimiter
        for value in line:gmatch("[^,]+") do
            table.insert(row, value)
        end
        table.insert(csvArray, row)
    end

    return frame.args[1]
end

return p