<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://new.ru-skazki.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3ARoman</id>
	<title>Модуль:Roman - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://new.ru-skazki.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3ARoman"/>
	<link rel="alternate" type="text/html" href="http://new.ru-skazki.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Roman&amp;action=history"/>
	<updated>2026-05-09T00:02:46Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>http://new.ru-skazki.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Roman&amp;diff=7104&amp;oldid=prev</id>
		<title>Andras: Новая страница: «-- This module implements {{Roman}}.  local p = {}  -- This function implements the {{overline}} template. local function overline( s )     return mw.ustring.format( &#039;&lt;span style=&quot;text-decoration:overline;&quot;&gt;%s&lt;/span&gt;&#039;, s ) end  -- Gets the Roman numerals for a given numeral table. Returns both the string of -- numerals and the value of the number after it is finished being processed. local function getLetters( num, t )     local ret = {}     for _, v in ipai...»</title>
		<link rel="alternate" type="text/html" href="http://new.ru-skazki.ru/index.php?title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C:Roman&amp;diff=7104&amp;oldid=prev"/>
		<updated>2024-02-24T14:07:53Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «-- This module implements {{Roman}}.  local p = {}  -- This function implements the {{overline}} template. local function overline( s )     return mw.ustring.format( &amp;#039;&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;&amp;#039;, s ) end  -- Gets the Roman numerals for a given numeral table. Returns both the string of -- numerals and the value of the number after it is finished being processed. local function getLetters( num, t )     local ret = {}     for _, v in ipai...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{Roman}}.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- This function implements the {{overline}} template.&lt;br /&gt;
local function overline( s )&lt;br /&gt;
    return mw.ustring.format( &amp;#039;&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;&amp;#039;, s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gets the Roman numerals for a given numeral table. Returns both the string of&lt;br /&gt;
-- numerals and the value of the number after it is finished being processed.&lt;br /&gt;
local function getLetters( num, t )&lt;br /&gt;
    local ret = {}&lt;br /&gt;
    for _, v in ipairs( t ) do&lt;br /&gt;
        local val, letter = unpack( v )&lt;br /&gt;
        while num &amp;gt;= val do&lt;br /&gt;
            num = num - val&lt;br /&gt;
            table.insert( ret, letter )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return table.concat( ret ), num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The main control flow of the module.&lt;br /&gt;
function p.convert( arg1, arg2 )&lt;br /&gt;
    -- Get input and exit displaying nothing if the input is bad.&lt;br /&gt;
    local num = tonumber( arg1 )&lt;br /&gt;
    if not num or num &amp;lt; 1 or num == math.huge then&lt;br /&gt;
        return&lt;br /&gt;
    end&lt;br /&gt;
    num = math.floor( num )&lt;br /&gt;
    &lt;br /&gt;
    -- Return a message for numbers too big to be expressed in Roman numerals.&lt;br /&gt;
    if num &amp;gt;= 5000000 then&lt;br /&gt;
        return arg2 or &amp;#039;N/A&amp;#039;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local ret = &amp;#039;&amp;#039;&lt;br /&gt;
    -- Find the Roman numerals for the large part of numbers 5000 and bigger.&lt;br /&gt;
    -- The if statement is not strictly necessary, but makes the algorithm &lt;br /&gt;
    -- more efficient for smaller numbers.&lt;br /&gt;
    if num &amp;gt;= 5000 then&lt;br /&gt;
        local bigRomans = {&lt;br /&gt;
            { 1000000, &amp;#039;M&amp;#039; },&lt;br /&gt;
            { 900000, &amp;#039;CM&amp;#039; }, { 500000, &amp;#039;D&amp;#039; }, { 400000, &amp;#039;CD&amp;#039; }, { 100000, &amp;#039;C&amp;#039; },&lt;br /&gt;
            { 90000, &amp;#039;XC&amp;#039; }, { 50000, &amp;#039;L&amp;#039; }, { 40000, &amp;#039;XL&amp;#039; }, { 10000, &amp;#039;X&amp;#039; },&lt;br /&gt;
            { 5000, &amp;#039;V&amp;#039; }&lt;br /&gt;
        }&lt;br /&gt;
        local bigLetters&lt;br /&gt;
        bigLetters, num = getLetters( num, bigRomans )&lt;br /&gt;
        ret = overline( bigLetters )&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Find the Roman numerals for numbers 4999 or less.&lt;br /&gt;
    local smallRomans = {&lt;br /&gt;
        {1000, &amp;quot;M&amp;quot;},&lt;br /&gt;
        {900, &amp;quot;CM&amp;quot;}, {500, &amp;quot;D&amp;quot;}, {400, &amp;quot;CD&amp;quot;}, {100, &amp;quot;C&amp;quot;},&lt;br /&gt;
        {90, &amp;quot;XC&amp;quot;}, {50, &amp;quot;L&amp;quot;}, {40, &amp;quot;XL&amp;quot;}, {10, &amp;quot;X&amp;quot;},&lt;br /&gt;
        {9, &amp;quot;IX&amp;quot;}, {5, &amp;quot;V&amp;quot;}, {4, &amp;quot;IV&amp;quot;}, {1, &amp;quot;I&amp;quot;} &lt;br /&gt;
    }&lt;br /&gt;
    local smallLetters = getLetters( num, smallRomans )&lt;br /&gt;
    ret = ret .. smallLetters&lt;br /&gt;
    &lt;br /&gt;
    return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main( frame )&lt;br /&gt;
    -- If called via #invoke, use the args passed into the invoking&lt;br /&gt;
    -- template, or the args passed to #invoke if any exist. Otherwise&lt;br /&gt;
    -- assume args are being passed directly in from the debug console&lt;br /&gt;
    -- or from another Lua module.&lt;br /&gt;
    local origArgs&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        origArgs = frame:getParent().args&lt;br /&gt;
        for k, v in pairs( frame.args ) do&lt;br /&gt;
            origArgs = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        origArgs = frame&lt;br /&gt;
    end&lt;br /&gt;
    -- Trim whitespace and remove blank arguments.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs( origArgs ) do&lt;br /&gt;
        if type( v ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
            v = mw.text.trim( v )&lt;br /&gt;
        end&lt;br /&gt;
        if v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return p.convert( args[ 1 ] , args[ 2 ] )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Andras</name></author>
	</entry>
</feed>