Jump to content

📢 Please make sure to read our Style Guide before editing. For questions, suggestions, or technical issues, please contact Noah.

Module:ButtonBox: Difference between revisions

From CrabCraft Wiki
testing new button box formatting
testing with avatars
Line 4: Line 4:
local args = {
local args = {
{
{
{ "Season4-End-Event-Banner.png", "Main Page", "Main Page" },
{ "https://mc-heads.net/avatar/SirIncognito/150.png", "Main Page", "Main Page" },
{ "Season4-End-Event-Banner.png", "Main Page", "Main Page" }
{ "https://mc-heads.net/avatar/AuroraFlight/150.png", "Main Page", "Main Page" }
},
},
{
{
{ "Season4-End-Event-Banner.png", "Main Page", "Main Page" },
{ "https://mc-heads.net/avatar/Steve/150.png", "Main Page", "Main Page" },
{ "Season4-End-Event-Banner.png", "Main Page", "Main Page" }
{ "https://mc-heads.net/avatar/Morbid/150.png", "Main Page", "Main Page" }
}
}
}
}

Revision as of 21:56, 23 June 2025

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

local p = {}

function p.buttonbox()
	local args = {
		{
			{ "https://mc-heads.net/avatar/SirIncognito/150.png", "Main Page", "Main Page" },
			{ "https://mc-heads.net/avatar/AuroraFlight/150.png", "Main Page", "Main Page" }
		},
		{
			{ "https://mc-heads.net/avatar/Steve/150.png", "Main Page", "Main Page" },
			{ "https://mc-heads.net/avatar/Morbid/150.png", "Main Page", "Main Page" }
		}
	}

	local out = {}
	table.insert(out, '{| class="buttonbox"')

	for _, row in ipairs(args) do
		table.insert(out, '|-\n')
		for _, button in ipairs(row) do
			local image = button[1]
			local link = button[2]
			local label = button[3]
			local cell = '| <div class="buttonbox-entry">[[File:'..image..'|100px|link='..link..'|alt='..label..']] <div class="buttonbox-label">'..label..'</div> </div>'

			table.insert(out, cell)
		end
	end

	table.insert(out, '|}')
	return table.concat(out, '\n')
end

return p