Minecraft Wiki
Нет описания правки
Нет описания правки
 
(не показана 1 промежуточная версия 1 участника)
Строка 3: Строка 3:
 
local args = f
 
local args = f
 
if f == mw.getCurrentFrame() then
 
if f == mw.getCurrentFrame() then
args = require( 'Module:ProcessArgs' ).merge( true )
+
args = require( 'Модуль:ProcessArgs' ).merge( true )
 
end
 
end
local block = mw.ustring.lower(mw.text.trim( args[1] or '' )):gsub("[_%(%)%-%s]+", '')
+
local block = mw.ustring.gsub(mw.ustring.lower(mw.text.trim( args[1] or '' )), "[_%(%)%-%s]+", '')
 
local type = mw.text.trim(args['тип'] or '') -- должен быть в родительном падеже
 
local type = mw.text.trim(args['тип'] or '') -- должен быть в родительном падеже
   
Строка 14: Строка 14:
 
local title = mw.title.getCurrentTitle()
 
local title = mw.title.getCurrentTitle()
 
if not args['некат'] and title.namespace == 0 and not title.isSubpage then
 
if not args['некат'] and title.namespace == 0 and not title.isSubpage then
category = '[[Категория:Отсутствующие значения ' .. mw.ustring.lc(type) .. ']]'
+
category = '[[Категория:Отсутствующие значения ' .. mw.ustring.lower(type) .. ']]'
 
end
 
end
 
end
 
end

Текущая версия от 16:11, 7 мая 2016

Этот модуль реализует списки значений блоков.

Значения

Зависимости

local p = {}
p.value = function( f )
	local args = f
	if f == mw.getCurrentFrame() then 
		args = require( 'Модуль:ProcessArgs' ).merge( true )
	end
	local block = mw.ustring.gsub(mw.ustring.lower(mw.text.trim( args[1] or '' )), "[_%(%)%-%s]+", '')
	local type = mw.text.trim(args['тип'] or '') -- должен быть в родительном падеже

	local value = mw.loadData( 'Модуль:Значения ' .. type)[block]
	local category = ''
	if not value then
		value = '[[Шаблон:Значения ' .. type .. '#Отсутствующее значение|?]]'
		local title = mw.title.getCurrentTitle()
		if not args['некат'] and title.namespace == 0 and not title.isSubpage then
			category = '[[Категория:Отсутствующие значения ' .. mw.ustring.lower(type) .. ']]'
		end
	end
	return value .. category
end
return p