No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
-- IMPORTANT! This assumes data is structured EXACTLY in this order! | |||
-- 1 Useless page identifier | |||
-- 2 |?Module:Name | |||
-- 3 |?Module:Class | |||
-- 4 |?Module:MaxEnhancementLevel | |||
-- 5 |?Module:CapacityCost0 | |||
-- 6 |?Module:ExclusiveCategory | |||
-- 7 |?Module:Effect0 | |||
-- 8 |?Module:Effect1 | |||
-- 9 |?Module:Effect2 | |||
-- 10 |?Module:Effect3 | |||
-- 11 |?Module:Effect4 | |||
-- 12 |?Module:Effect5 | |||
-- 13 |?Module:Effect6 | |||
-- 14 |?Module:Effect7 | |||
-- 15 |?Module:Effect8 | |||
-- 16 |?Module:Effect9 | |||
-- 17 |?Module:Effect10 | |||
local p = {} | local p = {} | ||
| Line 8: | Line 32: | ||
table.insert(splitArray, match) | table.insert(splitArray, match) | ||
end | end | ||
end | |||
local function generateTable() | |||
local tableHeader = [[ | |||
{| class="wikitable" style="width:100%;" | |||
|- | |||
! Level !! Cost !! Effect | |||
]] | |||
local tableContents = "" | |||
local maxLevel = splitArray[4] | |||
for i = 0,maxLevel do | |||
local row = | |||
"\n|-\n" .. | |||
"| ".. i.. | |||
" || " .. parsedArray[i][5] .. --TODO: Maths this instead of pulling raw | |||
" || " .. parsedArray[i][10 + i] --Effect0 is element 7, plus whatever element level we're looking at | |||
tableContents = tableContents .. row | |||
end | |||
local tableFooter = "\n|}" | |||
local tabContent = tableHeader .. tableContents .. tableFooter | |||
return tabTitle .. tabContent | |||
end | end | ||
| Line 16: | Line 66: | ||
split(frame.args.csv) | split(frame.args.csv) | ||
local | local table = generateTable | ||
return frame:preprocess(table) | |||
end | end | ||
return p | return p | ||
Revision as of 06:50, 5 June 2024
Documentation for this module may be created at Module:ModuleUniqueStatTable/doc
-- IMPORTANT! This assumes data is structured EXACTLY in this order!
-- 1 Useless page identifier
-- 2 |?Module:Name
-- 3 |?Module:Class
-- 4 |?Module:MaxEnhancementLevel
-- 5 |?Module:CapacityCost0
-- 6 |?Module:ExclusiveCategory
-- 7 |?Module:Effect0
-- 8 |?Module:Effect1
-- 9 |?Module:Effect2
-- 10 |?Module:Effect3
-- 11 |?Module:Effect4
-- 12 |?Module:Effect5
-- 13 |?Module:Effect6
-- 14 |?Module:Effect7
-- 15 |?Module:Effect8
-- 16 |?Module:Effect9
-- 17 |?Module:Effect10
local p = {}
local splitArray = {}
local function split(str)
splitArray = {}
for match in (str.."@"):gmatch("(.-)".."@") do
table.insert(splitArray, match)
end
end
local function generateTable()
local tableHeader = [[
{| class="wikitable" style="width:100%;"
|-
! Level !! Cost !! Effect
]]
local tableContents = ""
local maxLevel = splitArray[4]
for i = 0,maxLevel do
local row =
"\n|-\n" ..
"| ".. i..
" || " .. parsedArray[i][5] .. --TODO: Maths this instead of pulling raw
" || " .. parsedArray[i][10 + i] --Effect0 is element 7, plus whatever element level we're looking at
tableContents = tableContents .. row
end
local tableFooter = "\n|}"
local tabContent = tableHeader .. tableContents .. tableFooter
return tabTitle .. tabContent
end
function p.processData(frame)
if frame.args.csv == nil then
return "ERROR: Module:ModuleUniqueStatTable got no csv string! Please tell us on Discord!"
end
split(frame.args.csv)
local table = generateTable
return frame:preprocess(table)
end
return p