Editing
Module:Buffer/doc
(section)
From Thetacola Wiki
Jump to navigation
Jump to search
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!
======args.''htmlFunction''====== {{code|lang=lua|1=Element{{ndash}}Buffer:_add{ htmlFunction = object } }}<br /> {{code|lang=lua|1=Element{{ndash}}Buffer:_add{ htmlFunction = { arg-list, name = value } } }}<br /> If args.''key'' matches an {{luaref|HTML library|mw.html object function|y}} that does not have its own args section, this checks if the associated ''object'' is table. If not a table, or if <code>object.nodes</code> evaluates true, this calls the mw.html function with the object as the only argument. For table objects without an object.nodes, this iterates the table (non-recursively), repeatedly calling the named mw.html function with one or two arguments depending on key's type in each loop. Non-number key-value pairs are both passed as arguments. For numeric indices, only the value is passed. Boolean values are a no-op. Unlike with most implementions of [[#MBpairs|Module:Buffer's __pairs]], this first loops through ''non-''number keys, followed by number keys (still ordered from lowest to highest). Thus, something like {{code|lang=lua|1=Element{{ndash}}Buffer:_add{ attr = { 'width', width = 20 } } }} is equivalent to {{code|lang=lua|Element{{ndash}}Buffer:attr( 'width', 20 ):attr( 'width' )()}}, setting then unsetting the width attribute and returning the Element-Buffer for a net no-op (though the practical purpose of such is a mystery for this developer). For <code>args.css</code> only, this auto-replaces underscores with hypens for string keys{{--}}i.e., you may save four keystrokes/pair by typing <code>css_property =</code> instead of <code>["css-property"] =</code>. This does not apply to strings indexed at number keys. <!--//redundant? ======args.''bufferFunction''====== {{code|lang=lua|1=Element{{ndash}}Buffer:_add{ bufferFunction = object } }}<br /> {{code|lang=lua|1=Element{{ndash}}Buffer:_add{ bufferFunction = { expression{{ndash}}list } } }}<br /> If passed a table object that has no metatable such that {{code|lang=lua|object[1]}} exists, this {{luaref|unpack}}s the table from {{code|lang=lua|1}} and {{luaref|table.maxn|args=table}} for use as arguments for the Buffer object function named. Other objects are passed as the only argument to the designated function. //!--> <div style='font-size:smaller;'> ---- {{note label|skip1|β || Unlike with tables passed directly, [[Recursion (computer science)|recursive]] iterations for functions marked with <sup>β </sup> start at the smallest number greater than {{code|lang=lua|1}} instead of negative infinity.}} {{note label|skip2|β‘|| The iteration may start after {{code|lang=lua|2}} for some global functions.}} </div> |} {{anchor|loadable}}
Summary:
Please note that all contributions to Thetacola Wiki 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
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information