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

108 bytes løgd afturat ,  7 mánaðir síðan
s
Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html]
(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:...")
 
s (Bot: Erstatt forældet <source> -tag og parameteren "enclose" [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html])
 
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>.
=== print ===
 
<sourcesyntaxhighlight lang="lua">
print(s)
</syntaxhighlight>
</source>
 
Adds the string <var>s</var> to the buffer.
=== 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]].
== Example ==
 
<sourcesyntaxhighlight lang="lua">
local newBuffer = require('Module:OutputBuffer')
local p = {}
-- {{#invoke:TestModule|main}} would output:
-- "Welcome to the English Wikipedia. There are currently 4500000 articles on this site."
</syntaxhighlight>
</source>
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
14.816

rættingar