{{i}} Документація модуля[перегляд] [редагувати] [історія] [очистити кеш]

Використання ред.

Службовий модуль для Модуль:Wikidata.

Цей модуль містить код, запозичений з модуля «Wikidata/count» російської Вікіпедії.

Переклад
local p = {}

function p.getCount( context, options )
	if ( not context ) then error( 'context not specified' ); end;
	if ( not options ) then error( 'options not specified' ); end;
	if ( not options.entity ) then error( 'options.entity missing' ); end;

	local claims;
	if options.property then
		claims = context.selectClaims( options, options.property );
	end
	if claims == nil then
		return '';
	end
	
	return table.getn(claims);
end

function p.isMultiple( context, options )
	local count = p.getCount( context, options );
	local multiple = '';
	if( count ~= nil and count ~= '' and count > 1 ) then
		multiple = 1;
	end
	return multiple;
end

return p