Ouvrir le menu principal

Modifications

Module:Yesno

105 octets supprimés, 28 février 2018 à 14:14
+support for on/off
-- It works similarly to the template {{yesno}}.
return function (val, default, emptyDefault)
-- If your wiki uses non-ascii characters for any of "yes", "no", etc., you
-- should replace "val:lower()" with "mw.ustring.lower(val)" in the
or val == 'yes'
or val == 'y'
or val == 'oui'
or val == 'o'
or val == 'true'
or val == 't'
or val == 'on'
or tonumber(val) == 1
then
or val == 'no'
or val == 'n'
or val == 'non'
or val == 'false'
or val == 'f'
or val == 'off'
or tonumber(val) == 0
then
return false
elseif emptyDefault ~= nil and type(val) == 'string' and val:match( '^%s*$' ) then
return emptyDefault
else
return default
end
end
Utilisateur anonyme