IntToRomanStr = function(int) if (int < 1) then return "0"; elseif (int > 5000) then return ""; end -- if/else local str = ""; local digits = { {1000, "M"}, {500, "D"}, {100, "C"}, {50, "L"}, {10, "X"}, {5, "V"}, {1, "I"} }; local subs = { {"CCCC", "CD"}, {"XXXX", "XL"}, {"IIII", "IV"}, {"DCD", "CM"}, {"LXL", "XC"}, {"VIV", "IX"} }; for i = 1, table.getn(digits) do for y = 1, 1000 do if (int < digits[i][1]) then break; end -- if int = int-digits[i][1]; str = string.format("%s%s", str, digits[i][2]); end -- for end -- for for i = 1, table.getn(subs) do str = string.gsub(str, subs[i][1], subs[i][2]); end -- for return str; end -- function