Module:Repeat

From RuneRealm Wiki

This is the current revision of this page, as edited by Alex (talk | contribs) at 00:12, 17 October 2024 (Created page with "-- -- Repeats a string a certain number of times -- Template:Multi -- local p = {} function p.rep(frame) local args = frame:getParent().args local inp = args[1] local count = tonumber(args[2]) if not count then return error('You must pass a number to the second argument') end -- We very rarely use any of these templates; no need to facilitate a ton of potential spam; 500 is a fine maximum count = math.floor(count) if count > 500 then count = 500 en..."). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Template:No documentation/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Repeat/doc. [edit]
--
-- Repeats a string a certain number of times
-- [[Template:Multi]]
--

local p = {}

function p.rep(frame)
	local args = frame:getParent().args
	local inp = args[1]

	local count = tonumber(args[2])

	if not count then
		 return error('You must pass a number to the second argument')
	end

	-- We very rarely use any of these templates; no need to facilitate a ton of potential spam; 500 is a fine maximum
	count = math.floor(count)
	if count > 500 then
		count = 500
	end

	return string.rep(inp, count)
end

return p