Модуль:Sequence


local sequence = {}

function sequence.repeat_string (frame)
	local end_position = frame.args['count'] or tonumber( frame:getParent().args[1] ) or 1;
	local repeated_string = frame.args['string'] or frame:getParent().args[2] or '';
	local aux={};
	for i=1,end_position do 
		aux[i] = repeated_string 
	end;
	return table.concat(aux);
end;

function sequence.repeat_template (frame)
	local start_position = frame.args['start'] or 1;
	local end_position = frame.args['end'] or 1;
	local repeated_template = frame.args['template'] or '';
	local aux={};
	for i=start_position, end_position do
		aux[i-start_position+1] = frame:expandTemplate{title=repeated_template;args={i}}
	end;
	return table.concat(aux)
end

return sequence