Documentation[voir] [modifier] [historique] [purger]

Ce module est un module de mise au point (Mop signifiant mise au point). Ce module est rattaché à la page Utilisatrice:Lydie Noria/Bac à sable. Les fonctions présentes dans ce module, ne sont là que pour des besoins d'expérimentation et peuvent disparaître inopinément.

local p = {}

function factorielle(n)
    if n == 0 then
        return 1 -- on renvoie la valeur 1 quand le paramètre vaut 0
    else
        return n * factorielle(n - 1)
    end
end

function p.factorielle(frame)
	return factorielle(frame.args[1])
end

function ent(x)
	local y
	y = math.modf(x)
	return y
end

function p.ent(frame)
	return ent( frame.args[1] )
end

function frac(x)
	local y
	y = math.modf(x)
	y = x - y
	return y
end

function p.frac(frame)
	return frac( frame.args[1] )
end

function p.confirme(frame)
	return frame.args[1]
end

function p.mtable()
	local reponse = " "
	local t = {1,2,3,4,5,6}
	local mt = {}
	setmetatable(t,mt)
	for i = 1,6 do
		mt[i] = t[i] + 10
		reponse = reponse.."<br />a la clé "..i..", on trouve : "..mt[i]
	end
	return reponse
end

return p