No edit summary |
No edit summary |
||
| Line 23: | Line 23: | ||
function p.getTable(input) | function p.getTable(input) | ||
local array = p.parseCSV(input) | local array = p.parseCSV(input.args[1] ) | ||
return array[1][1] | return array[1][1] | ||
end | end | ||
return p | return p | ||
Revision as of 03:19, 4 June 2024
Documentation for this module may be created at Module:ModuleLevelTable/doc
local p = {}
function p.parseCSV(input)
local array = {}
local i = 1
-- Split the input by lines
for line in mw.text.split(input, "\n") do
array[i] = {}
local j = 1
-- Split each line by commas
for cell in mw.text.split(line, ",") do
array[i][j] = mw.text.trim(cell)
j = j + 1
end
i = i + 1
end
return array
end
function p.getTable(input)
local array = p.parseCSV(input.args[1] )
return array[1][1]
end
return p