Module:Tabber

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

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

local p = {}

function getArgCount(args)
	local count = 0 
	for _ in ipairs(args) do 
		count = count + 1
	end
	return count
end

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

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

return p