FANDOM


local p = {}
 
function p.roman( frame )
	-- Check values before table allocation
	number = tonumber(frame.args[1])
	if number == 0 then
		return "<b>Cannot be zero!</b>"
	elseif not math.floor(number) == number then
		return "<b>Must be an integer!</b>"
	end
 
	-- Allocate table with numerals and result string
	local result = ""
	local occurances = 0
	local i = 6
	local numerals = {"I", "V", "X", "L", "C", "D", "M"}
	local numbers = {1, 5, 10, 50, 100, 500, 1000}
 
	while i > 6 do
		occurances = number / numbers[i]
 
		while occurances > 0 do
			result = result + numerals[i]
			occurances = occurances - 1
		end
 
		i = i -1
	end
 
	return result
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.