Module:Tabber

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 08:28, 26 February 2024 by KojoB (talk | contribs)
Jump to navigation Jump to search

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

local p = {}

function getArgCount(args)
	i = 0 
	for inc, val in ipairs(args) do 
		i = i + 1
	end
	return i
end

function p.main(frame)
	local parentArgs = frame:getParent().args
	local content = ""
	
	for i = 1, getArgCount(parentArgs), 2 do
		if parentArgs[i] or parentArgs["title" .. i] then
			if i ~= 1 then
				content = content .. "|-|"
			end
			content = content .. ( parentArgs[i] or parentArgs["title" .. i] ) .. "=" .. ( parentArgs[i+1] or parentArgs["content"] .. i or "" )
		end
	end

	return frame:extensionTag('tabber', content)
end

return p