Module:Infobox/tabber: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
No edit summary
(stupid Lua)
Line 9: Line 9:
end
end
end
end
tabNums.sort()
table.sort(tabNums)
local tabberStr = ""
local tabberStr = ""
for _, i in ipairs(tabNums) do
for _, i in ipairs(tabNums) do

Revision as of 08:41, 19 December 2024

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

local p = {}

p.generateTabber = function(frame)
	local parentFrame = frame:getParent()
	local tabNums = {}
	for k, _ in pairs(parentFrame.args) do
		if type(k) == "number" and k > highestTab then
			table.insert(tabNumus, k)
		end
	end
	table.sort(tabNums)
	local tabberStr = ""
	for _, i in ipairs(tabNums) do
		if parentFrame.args[i] then
			tabberStr = tabberStr .. "|-|" .. (parentFrame.args["label" .. i] or i) .. "=<table style=\"width:100%;border-collapse:collapse\">" .. parentFrame.args[i] .. "</table>"
		end
	end
	if tabberStr == "" then
		return ""
	else
		return "<tr><td colspan=\"2\" style=\"padding:0\">" .. frame:extensionTag("tabber", tabberStr) .. "</td></tr>"
	end
end

return p