Module:Yesno: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
(Created page with "-- From <https://en.wikipedia.org/wiki/Module:Yesno> return function (val, default) val = type(val) == 'string' and val:lower() or val if val == nil then return nil else...")
 
m (RogerDodger moved page Module:YesNo to Module:Yesno without leaving a redirect)
 
(No difference)

Latest revision as of 07:29, 5 January 2022

Documentation for this module may be created at Module:Yesno/doc

-- From <https://en.wikipedia.org/wiki/Module:Yesno>

return function (val, default)
	val = type(val) == 'string' and val:lower() or val
	if val == nil then
		return nil
	elseif val == true 
		or val == 'yes'
		or val == 'y'
		or val == 'true'
		or val == 't'
		or val == 'on'
		or tonumber(val) == 1
	then
		return true
	elseif val == false
		or val == 'no'
		or val == 'n'
		or val == 'false'
		or val == 'f'
		or val == 'off'
		or tonumber(val) == 0
	then
		return false
	else
		return default
	end
end