<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3AOutputBuffer%2Fdoc</id>
	<title>Module:OutputBuffer/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pool.calebcooper.ie/index.php?action=history&amp;feed=atom&amp;title=Module%3AOutputBuffer%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:OutputBuffer/doc&amp;action=history"/>
	<updated>2026-04-08T11:22:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://pool.calebcooper.ie/index.php?title=Module:OutputBuffer/doc&amp;diff=12967&amp;oldid=prev</id>
		<title>Caleb Cooper: Created page with &quot;This module provides an easy and efficient way to generate lengthy strings.  == Usage ==  First, load the module.  &lt;syntaxhighlight lang=&quot;lua&quot;&gt; local newBuffer = require(&#039;Modu...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pool.calebcooper.ie/index.php?title=Module:OutputBuffer/doc&amp;diff=12967&amp;oldid=prev"/>
		<updated>2020-10-20T16:27:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This module provides an easy and efficient way to generate lengthy strings.  == Usage ==  First, load the module.  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; local newBuffer = require(&amp;#039;Modu...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This module provides an easy and efficient way to generate lengthy strings.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
First, load the module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local newBuffer = require(&amp;#039;Module:OutputBuffer&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, create the buffer and the functions that act on it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local getBuffer, print, printf = newBuffer()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== getBuffer ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local text = getBuffer(sep)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the contents of the buffer, with an optional separator string &amp;lt;var&amp;gt;sep&amp;lt;/var&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== print ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
print(s)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adds the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt; to the buffer.&lt;br /&gt;
&lt;br /&gt;
=== printf ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
printf(s, ...)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adds the string &amp;lt;var&amp;gt;s&amp;lt;/var&amp;gt; to the buffer. The string is formatted with any subsequent arguments, following the rules used for [[mw:Extension:Scribunto/Lua reference manual#String.format|string.format]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local newBuffer = require(&amp;#039;Module:OutputBuffer&amp;#039;)&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.main()&lt;br /&gt;
	local getBuffer, print, printf = newBuffer()&lt;br /&gt;
	print(&amp;#039;Welcome to the English Wikipedia.&amp;#039;)&lt;br /&gt;
	printf(&amp;#039;There are currently %d articles on this site.&amp;#039;, mw.site.stats.articles)&lt;br /&gt;
	return getBuffer(&amp;#039; &amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;br /&gt;
&lt;br /&gt;
-- Assuming this module&amp;#039;s name is &amp;quot;TestModule&amp;quot;, and that mw.site.stats.articles returns 4500000,&lt;br /&gt;
-- {{#invoke:TestModule|main}} would output:&lt;br /&gt;
-- &amp;quot;Welcome to the English Wikipedia. There are currently 4500000 articles on this site.&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{#ifeq:{{SUBPAGENAME}}|sandbox | |&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Lua metamodules]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Caleb Cooper</name></author>
	</entry>
</feed>