Jump to content

Module:OutputBuffer

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jackmcbarn (talk | contribs) at 23:50, 25 June 2014 (make a printf-like too). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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