No edit summary Tag: Reverted |
No edit summary Tags: Manual revert Reverted |
||
| Line 33: | Line 33: | ||
end | end | ||
return p | --return p | ||
Revision as of 14:58, 4 June 2024
Documentation for this module may be created at Module:ModuleLevelTable/doc
local p = {}
local parsedArray = {}
local function addToParsedArray(parsedTable)
parsedArray[#parsedArray+1] = {}
for i=1,#parsedTable do
parsedArray[#parsedArray][i] = parsedTable[i]
end
end
local function parseCSV(csvString) -- csvString is one line
local result = {}
for value in string.gmatch(csvString, '([^,]+)') do
table.insert(result, value)
end
return result
end
function p.process(frame)
--local csvText = frame.args[1] or ""
local csvText = "ModuleTestPage#_9a88490adf412a0c81fe3a2fa2d78e3c,Test Module Name,Transcendent,Almandine,High-Power Rounds,10,6,Resource,,,,,,,,,,"
-- Put all the CSV lines into an array
for line in csvText:gmatch("[^\r\n]+") do
local parsedLine = parseCSV(line)
if #parsedLine > 0 then
addToParsedArray(parsedLine)
end
end
return parsedArray[1][1]
end
--return p