Munurin millum rættingarnar hjá "Module:OutputBuffer/doc"

Content deleted Content added
Stovnaði síðu við "This module provides an easy and efficient way to generate lengthy strings. == Nýtsla == First, load the module. <source lang="lua"> local newBuffer = require('Module:..."
 
Xqbot (kjak | íkøst)
s Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]
 
Linja 5:
First, load the module.
 
<sourcesyntaxhighlight lang="lua">
local newBuffer = require('Module:OutputBuffer')
</syntaxhighlight>
</source>
 
Then, create the buffer and the functions that act on it.
 
<sourcesyntaxhighlight lang="lua">
local getBuffer, print, printf = newBuffer()
</syntaxhighlight>
</source>
 
=== getBuffer ===
 
<sourcesyntaxhighlight lang="lua">
local text = getBuffer(sep)
</syntaxhighlight>
</source>
 
Returns the contents of the buffer, with an optional separator string <var>sep</var>.
Linja 25:
=== print ===
 
<sourcesyntaxhighlight lang="lua">
print(s)
</syntaxhighlight>
</source>
 
Adds the string <var>s</var> to the buffer.
Linja 33:
=== printf ===
 
<sourcesyntaxhighlight lang="lua">
printf(s, ...)
</syntaxhighlight>
</source>
 
Adds the string <var>s</var> 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]].
Linja 41:
== Example ==
 
<sourcesyntaxhighlight lang="lua">
local newBuffer = require('Module:OutputBuffer')
local p = {}
Linja 57:
-- {{#invoke:TestModule|main}} would output:
-- "Welcome to the English Wikipedia. There are currently 4500000 articles on this site."
</syntaxhighlight>
</source>
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |