Munurin millum rættingarnar hjá "Module:OutputBuffer/doc"
Content deleted Content added
EileenSanda (kjak | íkøst) 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] |
||
Linja 5:
First, load the module.
<
local newBuffer = require('Module:OutputBuffer')
</syntaxhighlight>
Then, create the buffer and the functions that act on it.
<
local getBuffer, print, printf = newBuffer()
</syntaxhighlight>
=== getBuffer ===
<
local text = getBuffer(sep)
</syntaxhighlight>
Returns the contents of the buffer, with an optional separator string <var>sep</var>.
Linja 25:
=== print ===
<
print(s)
</syntaxhighlight>
Adds the string <var>s</var> to the buffer.
Linja 33:
=== printf ===
<
printf(s, ...)
</syntaxhighlight>
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 ==
<
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>
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
|