Մոդուլ:ArmenianNumber
Documentation for this module may be created at Մոդուլ:ArmenianNumber/doc
local m = {}
local digit_1000 = {[0] = "", [1] = "Ռ", [2] = "Ս", [3] = "Վ", [4] = "Տ", [5] = "Ր", [6] = "Ց", [7] = "Ու", [8] = "Փ", [9] = "Ք"}
local digit_100 = {[0] = "", [1] = "Ճ", [2] = "Մ", [3] = "Յ", [4] = "Ն", [5] = "Շ", [6] = "Ո", [7] = "Չ", [8] = "Պ", [9] = "Ջ"}
local digit_10 = {[0] = "", [1] = "Ժ", [2] = "Ի", [3] = "Լ", [4] = "Խ", [5] = "Ծ", [6] = "Կ", [7] = "Հ", [8] = "Ձ", [9] = "Ղ"}
local digit_1 = {[0] = "", [1] = "Ա", [2] = "Բ", [3] = "Գ", [4] = "Դ", [5] = "Ե", [6] = "Զ", [7] = "Է", [8] = "Ը", [9] = "Թ"}
function m.toArmenianNumber(n_number)
assert((n_number >= 1) and (n_number <= 9999))
local n_1000, n_100, n_10, n_1
n_1000 = math.floor(n_number/1000)
n_number = n_number - 1000*n_1000
n_100 = math.floor(n_number/100)
n_number = n_number - 100*n_100
n_10 = math.floor(n_number/10)
n_1 = n_number - 10*n_10
return digit_1000[n_1000]..digit_100[n_100]..digit_10[n_10]..digit_1[n_1]
end;
function m.armenian(frame)
return m.toArmenianNumber(tonumber(frame.args[1]))
end
return m