Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Armenian
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- This module implements {{Armenian}}. 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 == mw.getCurrentFrame() then num = frame:getParent().args[ 1 ] local frameArgsNum = frame.args[ 1 ] if frameArgsNum then num = frameArgsNum end else num = frame end -- 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 [[Module:Roman]] that can be stolen from to make it work. if num < 1 or num > 29999 then return '' end local numerals = { { 20000, "ี" }, { 10000, "ี" }, { 9000, "ี" }, { 8000, "ี" }, { 7000, "ี" }, { 6000, "ี" }, { 5000, "ี" }, { 4000, "ี" }, { 3000, "ี" }, { 2000, "ี" }, { 1000, "ี" }, { 900, "ี" }, { 800, "ี" }, { 700, "ี" }, { 600, "ี" }, { 500, "ี" }, { 400, "ี" }, { 300, "ี " }, { 200, "ี" }, { 100, "ี" }, { 90, "ี" }, { 80, "ี" }, { 70, "ี" }, { 60, "ิฟ" }, { 50, "ิพ" }, { 40, "ิฝ" }, { 30, "ิผ" }, { 20, "ิป" }, { 10, "ิบ" }, { 9, "ิน" }, { 8, "ิธ" }, { 7, "ิท" }, { 6, "ิถ" }, { 5, "ิต" }, { 4, "ิด" }, { 3, "ิณ" }, { 2, "ิฒ" }, { 1, "ิฑ" } } 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
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module other
(
edit
)
Template:Module rating
(
edit
)
Template:Ombox
(
edit
)
Template:Tl
(
edit
)
Module:Arguments
(
edit
)
Module:Armenian/doc
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Yesno
(
edit
)