Jump to content

Module:OutputBuffer: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Jackmcbarn (talk | contribs)
Created page with 'return function() local buffer = {} return function(text) buffer[#buffer + 1] = text end, function(sep) return table.concat(buffer, sep) end end'
 
Jackmcbarn (talk | contribs)
clear buffer after using
Line 5: Line 5:
end,
end,
function(sep)
function(sep)
local b = buffer
buffer = nil
return table.concat(buffer, sep)
return table.concat(buffer, sep)
end
end

Revision as of 23:46, 25 June 2014

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