Module:FellowCostumeUpgradeTable: Difference between revisions

From The Unofficial Isekai:Slow Life Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:


function p.main(frame)
function p.main(frame)
local args = frame:getParent().args
local args = frame.args
local skill = args.skill or "Unnamed Skill"
local skill = args.skill or "Unnamed Skill"
local img = args.img or "Placeholder.png"
local img = args.img or "Placeholder.png"

Revision as of 04:09, 31 July 2025

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

local p = {}

function p.main(frame)
	local args = frame.args
	local skill = args.skill or "Unnamed Skill"
	local img = args.img or "Placeholder.png"
	local typeName = args.type or ""
	local levels = args.levels or ""

	local rows = {}
	for line in mw.text.gsplit(levels, ";", true) do
		local parts = mw.text.split(mw.text.trim(line), ",")
		local level = parts[1] or ""
		local cap = parts[2] or ""
		local apt = parts[3] or ""
		table.insert(rows, string.format(
			'|-\n| style="text-align: center;" | %s || %s || %s',
			level, cap, apt
		))
	end

	local header = string.format([=[
{| class="wikitable" style="text-align: center;"
|+ [[File:%s|25px]] %s
|-
! Lv.
! Level Cap
! <abbr title="The Aptitude multiplier granted by this costume.">%s Aptitude</abbr>
]=], img, skill, typeName)

	return header .. "\n" .. table.concat(rows, "\n") .. "\n|}"
end

return p