Vai al contenuto

Modulo:Valido in corsivo/sandbox

Da Wikipedia, l'enciclopedia libera.
Versione del 24 ott 2017 alle 23:30 di Sakretsu (discussione | contributi) (includo fino al blocco Mathematical Operators)
local i = {}

-- Funzione per l'utilizzo da altro modulo
i._IsLatin = function(args)
	local txt = args[1]
	if txt == '' then return nil end
	
	local len = mw.ustring.len(txt)
	local pos = 1
	while (pos <= len) do
		charval = mw.ustring.codepoint(mw.ustring.sub(txt, pos))
		if charval >= 880 and charval < 8192 then
			return false
		elseif charval >= 8960 then
			return false
		end
		pos = pos + 1
	end
	return true
end

-- Funzione per il template IsLatin
i.IsLatin = function(frame)
	if frame.args[1] == '' then return end
	
	return i._IsLatin(frame.args) and 'sì' or 'no'
end

return i