Module:Resources: Difference between revisions

From Nova Roma Official Wiki
Created page with "local p = {} local icons = { wood = "30px|link=", metal = "30px|link=", stone = "30px|link=", gold = "30px|link=", } function p.format(frame) local input = frame.args[1] or "" local result = {} -- Split by comma and process each resource for resource in input:gmatch("[^,]+") do local amount, name = resource:match("(%d+)%s+(%w+)") if amount and name and icons[name..."
 
m 76561198021843184 moved page Module:Resource to Module:Resources without leaving a redirect
(No difference)

Revision as of 21:49, 24 February 2026

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

local p = {}

local icons = {
	wood = "[[File:icon_wood.png|30px|link=]]",
	metal = "[[File:icon_tools.png|30px|link=]]",
	stone = "[[File:icon_stone.png|30px|link=]]",
	gold = "[[File:icon_gold.png|30px|link=]]",
}

function p.format(frame)
	local input = frame.args[1] or ""
	local result = {}
	
	-- Split by comma and process each resource
	for resource in input:gmatch("[^,]+") do
		local amount, name = resource:match("(%d+)%s+(%w+)")
		if amount and name and icons[name] then
			table.insert(result, amount .. " " .. icons[name])
		end
	end
	
	return table.concat(result, "<br>")
end

return p