Module:deva-last-char-type

From Wiktionary, the free dictionary
Jump to navigation Jump to search

local p = {}
function p.check(text)
	t =  text.args.text
	local length = string.len(t)
	local last = string.sub(t, -3, -1)
	if length > 2 then
		local vowels = {"ि", "ी", "ॖ", "ॗ", "ु", "ू", "ॆ", "े", "ऺ", "ऻ", "ॊ","ो", "ॏ", "ा", "ै", "ौ", "ृ", "ं", "्", "ँ", "ॶ", "ॷ", "इ", "ई", "उ", "ऊ", "ऎ", "ए", "ॳ", "ॴ", "ऒ", "ओ", "ॵ", "अ", "आ", "ऐ", "औ"}
		for index, value in ipairs(vowels) do
	        if value == last then
	        	return "vowel"
	        end
		end
	    return "cons"
	end
	error("Invalid sting")
end
return p