Jump to content

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

Module:ButtonBox

From CrabCraft Wiki
Revision as of 22:09, 23 June 2025 by Noah (talk | contribs) (removed extra image tag text)

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">'..image..'><div class="buttonbox-label">'..label..'</div> </div>'

			table.insert(out, cell)
		end
	end

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

return p