Module:Tabber

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 08:31, 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 = ""
	
	j = 1
	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" .. j] ) .. "=" .. ( parentArgs[i+1] or parentArgs["content" .. j] or "" )
		end
		j = j + 1
	end

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

return p