Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
IndicWiki Sandbox
Search
Search
English
Log in
Personal tools
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Buffer/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Tips and style recommendations=== * If [[#Buffer|joining Buffer]] with a string immediately after <code>:_'<i>text</i>'</code>, place a space between 'string' and the [[#Buffer|separator]] and use double/single quote marks to . (i.e. <code>:_'<i>text</i>' " "</code> instead of <code>:_'<i>text</i>'{{`}} '</code> or <code>:_'<i>text</i>'(' ')</code>) * Saving Module:Buffer locally, e.g. <code>local Buffer = {{luaref|require|args='Module:Buffer'|plain=y}}</code>, though fine, is often unnecessary since all Buffer objects can create new buffers via {{luaself|:_in}}. '''For {{luaself|:_}}''' * Treat {{code|:_}} as though it were a {{code|..}} op. Wrapping strings with unnecessary {{code|()}} is akin to {{code|( 'string1' ) .. ( 'string2' ) .. ( 'string3' )}}. * To insert an empty string as a placeholder for a [[#Buffer|separator]] without setting {{code|raw}}, pass a table containing only an empty string, like so: {{luaself|:_|args={''} }}. * Raw appending a non-table is pointless since no other Scribunto type can tostring differently afterwards. However, this developer believes you are smart enough that {{code|lang=lua|1=raw and type(v)=='table'}} is a waste of server resources. (Such checks are why {{luaref|mw.html:wikitext||y}} takes twice as much time to append a list of strings as {{luaself|pre=Stream-|:each|plain=y}} despite their near-identical roles in an Element-Stream-Buffer). '''For {{luaself|:_out}} and {{luaself|:_str}}''' * Something like {{code|lang=lua|Buffer_str(2, false, A, false, {C, B})}} will use variable <code>A</code> as the parent's separator, or <code>B</code> instead if ''A'' is nil, or <code>C</code> if both A and B are nil. '''For {{luaself|:_all}}''' * Appending values in multiple locations is one of the primary reasons why the [[#nanKeys|nanKeys]] argument exists. While passing a boolean directly will cause an error, you can do something like... ::this:{{sp|3}}{{code|1=Buffer:_all({condition and {_nil={'0', 'replacement'},Front=1,getParent='from child'{{))}}}, true)|lang=lua}} ::versus: {{code|lang=lua|Buffer:_nil('0', condition and 'replacement' or false):_(condition and 'Front', 1):getParent(condition and 'from child'):_B(child)}}. '''For {{luaself|:_cc}}''' * If the table reference passed as {{code|clear}} was appended [[#raw|raw]] in multiple positions, this is akin to performing {{luaself|:_nil}} at all positions simultaneously. (May be easier than trying to come up with a {{luaref|string.gsub}} pattern) * Inserting a [[#Buffer:_G|named]] empty table is raw as a placeholder to be populated later via this function may be easier than calculating ''pos'' argument of {{luaself|:_}}.
Summary:
Please note that all contributions to IndicWiki Sandbox may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
My wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width