Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Gacha tabs: Difference between revisions

From Sekaipedia
Content deleted Content added
MathTurtle (talk | contribs)
No edit summary
MathTurtle (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
if gachaName == nil or gachaName == '' then
if gachaName == nil or gachaName == '' then
error('Gacha name cannot be empty.')
error('Gacha name cannot be empty.')
end
if numTabs < 1 then
error('Number of tabs cannot be less than 1.')
end
end


if numTabs == 2 then
builder
builder
:addTab(gachaName, args[3])
:addTab(gachaName .. ' - Reprint', args[4])
:addTab(gachaName, args[3])
:addTab(gachaName .. '/Reprint', args[4])
elseif numTabs == 3 then
builder
:addTab(gachaName, args[3])
:addTab(gachaName .. '/Reprint', args[4])
:addTab(gachaName .. '/Reprint_2', args[5])
elseif numTabs == 4 then
builder
:addTab(gachaName, args[3])
:addTab(gachaName .. '/Reprint', args[4])
:addTab(gachaName .. '/Reprint_2', args[5])
:addTab(gachaName .. '/Reprint_3', args[6])
end
return builder:tostring()
return builder:tostring()

Latest revision as of 02:12, 13 July 2024

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

local getArgs = require('Module:Arguments').getArgs
local TabsBuilder = require('Module:TabsBuilder')

local p = {}

function p.main(frame)
	local args = getArgs(frame)

	local builder = TabsBuilder.new()
	
	local gachaName = args[1]
	
	local numTabs = tonumber(args[2])
	
	if gachaName == nil or gachaName == '' then
		error('Gacha name cannot be empty.')
	end

	if numTabs == 2 then
		builder
			:addTab(gachaName, args[3])
			:addTab(gachaName .. '/Reprint', args[4])
	elseif numTabs == 3 then
		builder
			:addTab(gachaName, args[3])
			:addTab(gachaName .. '/Reprint', args[4])
			:addTab(gachaName .. '/Reprint_2', args[5])
	elseif numTabs == 4 then
		builder
			:addTab(gachaName, args[3])
			:addTab(gachaName .. '/Reprint', args[4])
			:addTab(gachaName .. '/Reprint_2', args[5])
			:addTab(gachaName .. '/Reprint_3', args[6])
	end
	
	return builder:tostring()
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.