Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Undefined array key 1 in /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php on line 339

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 253

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80
Модуль:Yesno — Энциклопедия Акриции

Модуль:Yesno

Материал из Энциклопедия Акриции
Версия от 08:31, 8 января 2024; Unifiedakricia (обсуждение | вклад) (Новая страница: «-- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (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' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == '...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

Для документации этого модуля может быть создана страница Модуль:Yesno/doc

-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.

return function (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' 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 == 'да'
		or val == 'д'
        or val == '+'
		or tonumber(val) == 1
	then
		return true
	elseif val == false
		or val == 'no'
		or val == 'n'
		or val == 'false'
		or val == 'f'
		or val == 'нет'
		or val == 'н'
		or val == '-'
		or tonumber(val) == 0
	then
		return false
	else
		return default
	end
end

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /lilacspace/sites/ru.wiki.akrt.me/extensions/Scribunto/includes/Engines/LuaStandalone/LuaStandaloneInterpreter.php:339) in /lilacspace/sites/ru.wiki.akrt.me/includes/Request/WebResponse.php on line 80