Module:ModuleUniqueStatTable

From The First Descendant Wiki
Revision as of 06:01, 5 June 2024 by Software2 (talk | contribs)

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

local p = {}

function parseCSV(csv)
    local result = {}
    local cell = ""
    local inQuotes = false

    for i = 1, #csv do
        local char = csv:sub(i, i)
        
        if char == '"' then
            inQuotes = not inQuotes
        elseif char == '@' and not inQuotes then
            table.insert(result, cell)
            cell = ""
        elseif char == '\n' and not inQuotes then
            table.insert(result, cell)
            cell = ""
        else
            cell = cell .. char
        end
    end

    if cell == "" then
        cell = "Q"
    end

    table.insert(result, cell)

    return result
end

function p.processData(frame)
    local property1 = frame.args.property1 or ""
    local property2 = frame.args.property2 or ""
    local name = frame.args.name or "DNE"
    
    -- Process the data
    local result = "Name: " .. name .. name .. name .. ", Property2: " .. property2
    
    return frame.args[0]
end

return p