« Module:Outils » : différence entre les versions
code de trim plus performant ; quand on multiplie par le nombre d'utilisations de cette fonction sur tout le wiki, le gain doit être intéressant |
m 1 version importée |
||
| (2 versions intermédiaires par 2 utilisateurs non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
local mwTrim = mw.text.trim | |||
local Outils = { } | local Outils = { } | ||
| Ligne 9 : | Ligne 11 : | ||
function Outils.trim( texte ) | function Outils.trim( texte ) | ||
if type( texte ) == 'string' and texte ~= '' then | if type( texte ) == 'string' and texte ~= '' then | ||
texte = mwTrim( texte ) | |||
texte = | |||
if texte ~= '' then | if texte ~= '' then | ||
return texte | return texte | ||