Module:OutputBuffer: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Jackmcbarn
m use the right table
meta>Jackmcbarn
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

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

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