Jump to content

Module:OutputBuffer: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Jackmcbarn (talk | contribs)
m use the right table
Jackmcbarn (talk | contribs)
make a printf-like too
Line 3: Line 3:
return function(text)
return function(text)
buffer[#buffer + 1] = text
buffer[#buffer + 1] = text
end,
function(...)
buffer[#buffer + 1] = string.format(...)
end,
end,
function(sep)
function(sep)

Revision as of 23:50, 25 June 2014

return function()
	local buffer = {}
	return function(text)
		buffer[#buffer + 1] = text
	end,
	function(...)
		buffer[#buffer + 1] = string.format(...)
	end,
	function(sep)
		local b = buffer
		buffer = nil
		return table.concat(b, sep)
	end
end