વિભાગ:OutputBuffer/doc: આવૃત્તિઓ વચ્ચેનો તફાવત
Content deleted Content added
KartikMistry (ચર્ચા | યોગદાન) નાનું en:Module:OutputBuffer/doc માંથી આયાત કરેલ ૨ પુનરાવર્તનો |
નાનું Bot: Replace deprecated <source> tag and "enclose" parameter [https://lists.wikimedia.org/pipermail/wikitech-ambassadors/2020-April/002284.html] |
||
લીટી ૫:
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>.
લીટી ૨૫:
=== print ===
<
print(s)
</syntaxhighlight>
Adds the string <var>s</var> to the buffer.
લીટી ૩૩:
=== 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]].
લીટી ૪૧:
== Example ==
<
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>
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
|