Module:Yesno
Appearance
![Documentation icon](https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png)
You might want togibuhona documentation page for thisScribunto module. Editors can experiment in this module's sandbox(gibuhon|salmíng)and testcases(gibuhon)pages. Pakiulay na magdagdag nin mga kategorya sa subpahinang/doc.Subpages of this modyul. |
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
returnfunction(val,default)
-- 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
-- following line.
val=type(val)=='string'andval:lower()orval
ifval==nilthen
returnnil
elseifval==true
orval=='yes'
orval=='y'
orval=='true'
orval=='t'
orval=='on'
ortonumber(val)==1
then
returntrue
elseifval==false
orval=='no'
orval=='n'
orval=='false'
orval=='f'
orval=='off'
ortonumber(val)==0
then
returnfalse
else
returndefault
end
end