Module:OutputBuffer
- Anarâškielâ
- Аԥсшәа
- العربية
- অসমীয়া
- تۆرکجه
- Basa Bali
- বাংলা
- भोजपुरी
- Bosanski
- Català
- Dansk
- الدارجة
- ދިވެހިބަސް
- فارسی
- Føroyskt
- Furlan
- ગુજરાતી
- 한국어
- Ilokano
- Bahasa Indonesia
- Italiano
- ಕನ್ನಡ
- Kapampangan
- Kurdî
- Ladin
- Ligure
- Lombard
- Македонски
- മലയാളം
- मराठी
- ဘာသာမန်
- مازِرونی
- 閩東語 / Mìng-dĕ̤ng-ngṳ̄
- Монгол
- မြန်မာဘာသာ
- Nederlands
- नेपाली
- 日本語
- Norsk bokmål
- ଓଡ଼ିଆ
- Oʻzbekcha / ўзбекча
- ਪੰਜਾਬੀ
- پښتو
- Piemontèis
- Português
- Română
- Scots
- Sicilianu
- Simple English
- سنڌي
- Slovenčina
- Slovenščina
- کوردی
- Српски / srpski
- Tarandíne
- တႆး
- ไทย
- Türkçe
- Українська
- اردو
- Tiếng Việt
- 文言
- 中文
Appearance
From Wikipedia, the free encyclopedia
This module provides an easy and efficient way to generate lengthy strings.
Usage
First, load the module.
local newBuffer = require('Module:OutputBuffer')
Then, create the buffer and the functions that act on it.
local getBuffer, print, printf = newBuffer()
getBuffer
local text = getBuffer(sep)
Returns the contents of the buffer, with an optional separator string sep.
print(s)
Adds the string s to the buffer.
printf
printf(s, ...)
Adds the string s to the buffer. The string is formatted with any subsequent arguments, following the rules used for string.format.
Example
local newBuffer = require('Module:OutputBuffer') local p = {} function p.main() local getBuffer, print, printf = newBuffer() print('Welcome to the English Wikipedia.') printf('There are currently %d articles on this site.', mw.site.stats.articles) return getBuffer(' ') end return p -- Assuming this module's name is "TestModule", and that mw.site.stats.articles returns 4500000, -- {{#invoke:TestModule|main}} would output: -- "Welcome to the English Wikipedia. There are currently 4500000 articles on this site."
The above documentation is transcluded from Module:OutputBuffer/doc. (edit | history)
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Subpages of this module.