Module:OutputBuffer: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Jackmcbarn
clear buffer after using
Ookami (talk | contribs)
m 6 revisions imported
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
return function()
return function()
local buffer = {}
local buffer = {}
return function(text)
return function(sep)
local b = buffer
buffer = {}
return table.concat(b, sep)
end,
function(text)
buffer[#buffer + 1] = text
buffer[#buffer + 1] = text
end,
end,
function(sep)
function(...)
local b = buffer
buffer[#buffer + 1] = string.format(...)
buffer = nil
return table.concat(buffer, sep)
end
end
end
end

Latest revision as of 14:08, 3 September 2020

Documentation for this module may be created at Module:OutputBuffer/doc

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