1
0
forked from tommy/tommy-bot
Files
tommy-bot/src/modules/ordinal.lua
tommy aka doge 5d20986e54 add src files
2022-04-03 17:53:48 -04:00

9 lines
251 B
Lua

s=string.sub;t=tonumber
return function(n)
local o, d = {"st", "nd", "rd"}, s(n, -1)
if t(d) > 0 and t(d) <= 3 and s(n,-2) ~= 11 and s(n,-2) ~= 12 and s(n,-2) ~= 13 then
return n .. o[t(d)]
else
return n .. "th"
end
end