-- This module implements . It converts numbers to old Armenian-- numerals, for numbers from 1-29999.
local p =
function p.main(frame) -- If we are being called from #invoke, then the number is the first positional -- argument. If not, it is the frame parameter. local num if frame
-- Convert the input to an integer if possible. if type(num) ~= 'number' then num = tonumber(num) end if not num then return end
num = math.floor(num) -- Exit if the number is not expressible in Armenian numerals. -- FIXME: Check if Armenian numerals can really be made 10,000x bigger through -- overlining them as it says in our article. (That claim is unsourced.) If they -- can, there is code at that can be stolen from to make it work. if num < 1 or num > 29999 then return end local numerals = local ret = for _, v in ipairs(numerals) do local val, letter = unpack(v) while num >= val do num = num - val table.insert(ret, letter) end end return table.concat(ret)end
return p