Modul:OrdinalSuffix
Tampilan
require('strict')
local p = {}
function p.main(frame)
local n = tonumber(frame.args[1])
if math.floor((n % 100) / 10) == 1 then
return n .. 'th'
end
local l = n % 10
if l == 1 then
return n .. 'st'
elseif l == 2 then
return n .. 'nd'
elseif l == 3 then
return n .. 'rd'
end
return n .. 'th'
end
return p