Sha256: 87a77e3fe4276f21d86d6c55366197a95b20541170a362bb4a7da0e41a923234
Contents?: true
Size: 708 Bytes
Versions: 396
Compression:
Stored size: 708 Bytes
Contents
local mappings = { { value = 1000, numeral = 'M' }, { value = 900, numeral = 'CM' }, { value = 500, numeral = 'D' }, { value = 400, numeral = 'CD' }, { value = 100, numeral = 'C' }, { value = 90, numeral = 'XC' }, { value = 50, numeral = 'L' }, { value = 40, numeral = 'XL' }, { value = 10, numeral = 'X' }, { value = 9, numeral = 'IX' }, { value = 5, numeral = 'V' }, { value = 4, numeral = 'IV' }, { value = 1, numeral = 'I' }, } return { to_roman = function(n) local result = '' for _, mapping in ipairs(mappings) do while n >= mapping.value do result = result .. mapping.numeral n = n - mapping.value end end return result end }
Version data entries
396 entries across 396 versions & 1 rubygems