<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://chaldeanwiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ABuffer</id>
		<title>Module:Buffer - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://chaldeanwiki.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ABuffer"/>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;action=history"/>
		<updated>2026-04-30T13:37:05Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.0</generator>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=3433&amp;oldid=prev</id>
		<title>Ian: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=3433&amp;oldid=prev"/>
				<updated>2015-05-19T01:35:27Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 01:35, 19 May 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Ian</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=3432&amp;oldid=prev</id>
		<title>Mr. Stradivarius: Protected Module:Buffer: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=3432&amp;oldid=prev"/>
				<updated>2015-05-15T16:15:29Z</updated>
		
		<summary type="html">&lt;p&gt;Protected Module:Buffer: &lt;a href=&quot;/index.php?title=WP:High-risk_templates&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:High-risk templates (page does not exist)&quot;&gt;High-risk Lua module&lt;/a&gt; ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:15, 15 May 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mr. Stradivarius</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=2446&amp;oldid=prev</id>
		<title>Codehydro: more changes than can fit in this summary; held back update for months to avoid flooding job queue</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=2446&amp;oldid=prev"/>
				<updated>2015-04-29T21:58:04Z</updated>
		
		<summary type="html">&lt;p&gt;more changes than can fit in this summary; held back update for months to avoid flooding job queue&lt;/p&gt;
&lt;a href=&quot;https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;amp;diff=2446&amp;amp;oldid=602&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Codehydro</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=602&amp;oldid=prev</id>
		<title>Ian: 1 revision imported: Maria Theresa Asmar</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=602&amp;oldid=prev"/>
				<updated>2015-03-30T21:32:57Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision imported: Maria Theresa Asmar&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 21:32, 30 March 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Ian</name></author>	</entry>

	<entry>
		<id>https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=601&amp;oldid=prev</id>
		<title>Codehydro: slight performance improvement</title>
		<link rel="alternate" type="text/html" href="https://chaldeanwiki.com/index.php?title=Module:Buffer&amp;diff=601&amp;oldid=prev"/>
				<updated>2015-02-18T19:09:35Z</updated>
		
		<summary type="html">&lt;p&gt;slight performance improvement&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[=============================&lt;br /&gt;
This Module was written by English wikipedia User:Codehydro&lt;br /&gt;
All methods were developed independently and any resemblance to other string buffer libraries would be coincidental.&lt;br /&gt;
&lt;br /&gt;
Licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License&lt;br /&gt;
https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License&lt;br /&gt;
&lt;br /&gt;
https://en.wikipedia.org/wiki/Module:Buffer&lt;br /&gt;
https://en.wikipedia.org/wiki/User:Codehydro&lt;br /&gt;
=============================--]]&lt;br /&gt;
return setmetatable({[type] = function(v)&lt;br /&gt;
		if v and v~=true then--reject nil/boolean; faster than 2 type() comparisons&lt;br /&gt;
			local str = tostring(v)&lt;br /&gt;
			if str~=v and str=='table' then return table.concat(v) end&lt;br /&gt;
			return str~='' and str or nil&lt;br /&gt;
		end&lt;br /&gt;
	end,&lt;br /&gt;
	[select] = function(n, ...)&lt;br /&gt;
		local seps, meta = {select(2, ...)}&lt;br /&gt;
		if type(seps[#seps])=='table' then&lt;br /&gt;
			meta = rawset(table.remove(seps), '__index', function(t, i) return meta[1] end)&lt;br /&gt;
			setmetatable(seps, meta)&lt;br /&gt;
		end&lt;br /&gt;
		return ..., seps&lt;br /&gt;
	end,&lt;br /&gt;
	__index = {&lt;br /&gt;
		_ = function(self, v, ...)&lt;br /&gt;
			local at, raw&lt;br /&gt;
			if select('#', ...)==1 and ...==not not... then raw = ...&lt;br /&gt;
			else at, raw = ... end&lt;br /&gt;
			if raw then self[rawset] = math.huge else v = getmetatable(self)[type](v) end&lt;br /&gt;
			if v or raw then&lt;br /&gt;
				if at then&lt;br /&gt;
					if tostring(at)==at then at = #self + at end&lt;br /&gt;
					if at &amp;lt; 1 then self[rawset] = math.huge&lt;br /&gt;
					elseif at &amp;gt; #self + 1 then self[rawset] = self[rawset] and math.max(at, self[rawset]) or at end&lt;br /&gt;
				end&lt;br /&gt;
				self.last_concat = table.insert(self, select(at and 1 or 2, at, v))&lt;br /&gt;
			end&lt;br /&gt;
			return self&lt;br /&gt;
		end,&lt;br /&gt;
		_nil = function(self, at, v2)&lt;br /&gt;
			if v2~=true and v2~=false then--faster than type(v2) ~= 'boolean'&lt;br /&gt;
				self.last_concat = nil&lt;br /&gt;
				if at=='0' or at==nil then&lt;br /&gt;
					self[#self] = v2&lt;br /&gt;
					if v2 then self[rawset] = math.huge end&lt;br /&gt;
				else&lt;br /&gt;
					if tostring(at)==at then at = #self + at end&lt;br /&gt;
					if v2 or self[rawset] or at &amp;lt; 1 or at &amp;gt; #self + 1 then self[at], self[rawset] = v2, math.huge&lt;br /&gt;
					else table.remove(self, at) end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return self&lt;br /&gt;
		end,&lt;br /&gt;
		_all = function(self, t, valKey)&lt;br /&gt;
			for k, v in getmetatable(self).__pairs(t) do self:_mix(v) end&lt;br /&gt;
			if valKey then&lt;br /&gt;
				for k, v in getmetatable(self).__pairs(t, false) do&lt;br /&gt;
					if tonumber(v) then self:_(k, v) end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return self&lt;br /&gt;
		end,&lt;br /&gt;
		_mix = function(self, v, a) return v and ((type(v)~='table' or getmetatable(v)) and self._ or self._all)(self, v, a) or self end,--internal helper, do not list in doc&lt;br /&gt;
		_str = function(self, ...) return getmetatable(self).__tostring(self, ...) end,&lt;br /&gt;
		_in = function (self, ...) return rawset(getmetatable(self)(...), next, self) end,--Module:Buffer objects use [next] rather than 'parent' to avoid traversal by mw.html.allDone()&lt;br /&gt;
		_out = function(self, ...)&lt;br /&gt;
			if self[next] then&lt;br /&gt;
				local n, parent = select('#', ...), self[next]&lt;br /&gt;
				if n &amp;gt; 1 then&lt;br /&gt;
					local k, outs, seps = 1, getmetatable(self)[select](n, ...)&lt;br /&gt;
					while outs &amp;gt; 0 do&lt;br /&gt;
						parent:_(self(seps[k]))&lt;br /&gt;
						self, parent, k = parent, parent[next], k + 1&lt;br /&gt;
						outs = parent and outs - 1 or 0&lt;br /&gt;
					end&lt;br /&gt;
				else return parent:_(self(...)) end&lt;br /&gt;
			end&lt;br /&gt;
			return self[next] or self&lt;br /&gt;
		end,&lt;br /&gt;
		_c = function(self, clear, copy)&lt;br /&gt;
			assert(type(clear)=='table', copy and&lt;br /&gt;
				&amp;quot;Buffer:_c(clear, copy) only accepts tables for arg 'clear'.&amp;quot;&lt;br /&gt;
				or &amp;quot;Two possible causes: 1) Called Buffer:_c(clear, copy) without colon, or 2) Type of 'clear' is not 'table'.&amp;quot;&lt;br /&gt;
			)&lt;br /&gt;
			for k in next, clear do clear[k] = nil end&lt;br /&gt;
			local meta, copyMeta, copyType = getmetatable(self)&lt;br /&gt;
			if copy then&lt;br /&gt;
				if type(copy)=='table' then&lt;br /&gt;
					for k, v in next, copy do clear[k] = type(v)=='table' and mw.clone(v) or v end&lt;br /&gt;
					clear[rawset] = clear[rawset] or math.huge&lt;br /&gt;
					copyMeta = getmetatable(copy)&lt;br /&gt;
					if copyMeta then&lt;br /&gt;
						if not buffHTMLmeta then meta():_inHTML() end&lt;br /&gt;
						if copyMeta==buffHTMLmeta[mw.html] then&lt;br /&gt;
							copyMeta = buffHTMLmeta&lt;br /&gt;
							setmetatable(clear.nodes, meta)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				elseif meta[type](copy) then clear[1] = copy end&lt;br /&gt;
			end&lt;br /&gt;
			setmetatable(clear, copyMeta or meta)&lt;br /&gt;
			return self&lt;br /&gt;
		end,&lt;br /&gt;
		_parent = function(self, s, outs, ...) return self:_(outs and self[next]:_str(s, outs, ...) or self[next](s)) end,&lt;br /&gt;
		getParent = function(self, ...) return (assert(self, ' (:function(), not .function())')[next] or rawset(rawset(self, next, getmetatable(self)())[next], require, {self})):_(...) end,&lt;br /&gt;
		_inHTML = function(self, ...)&lt;br /&gt;
			local HTML, meta = mw.html.create(...), getmetatable(self)&lt;br /&gt;
			if not rawget(_G, 'buffHTMLmeta') then&lt;br /&gt;
				local mwHTMLmeta = getmetatable(mw.html.create())&lt;br /&gt;
				buffHTMLmeta, mwHTMLfunc = rawset(mw.clone(mwHTMLmeta), mw.html, mwHTMLmeta), mwHTMLmeta.__index&lt;br /&gt;
				for k, v in next, {&lt;br /&gt;
					[rawget] = function(HTML, Buffer, ...)&lt;br /&gt;
						buffHTMLmeta[require] = HTML&lt;br /&gt;
						if ... then return select('#', ...)==1 and Buffer:_(...) or assert(Buffer[...], ('&amp;quot; %s &amp;quot; does not match any Module:Buffer function'):format(tostring(...)))(Buffer, select(2, ...)) end&lt;br /&gt;
						return Buffer&lt;br /&gt;
					end,&lt;br /&gt;
					getParent = function(HTML, ...) return HTML[rawget](HTML, HTML:allDone()[next], ...) end,--return to buffer that created it&lt;br /&gt;
					getBuffer = function(HTML, ...) return HTML[rawget](HTML, buffHTMLmeta[next], ...) end,--return to last buffer used&lt;br /&gt;
					_out = function(HTML, ...) return HTML:getParent():_(HTML):_out(...) end,&lt;br /&gt;
					_inv = function(HTML, s, outs, ...) return HTML.nodes:_(outs and HTML:getParent():_str(s, outs, ...) or HTML:getParent()(s)) end&lt;br /&gt;
				} do buffHTMLmeta.__index[k] = v end&lt;br /&gt;
				if new_G then&lt;br /&gt;
					for k, v in pairs(gfuncs) do buffHTMLmeta.__index[k] = v end&lt;br /&gt;
					gfuncs = nil&lt;br /&gt;
				end&lt;br /&gt;
				local mbpairs, outFuncs, htmlArg, nonSelf, spinach = meta.__pairs, {}, {parent = true, selfClosing = true, tagName = true}, {tag = true, done = true, allDone = true}&lt;br /&gt;
				spinach = {--spinach makes html.nodes buffer... get it?...&lt;br /&gt;
					[rawset] = math.huge,&lt;br /&gt;
					_out = function(nodes, ...) return nodes:getParent('_', nodes:getHTML()):_out(...) end,&lt;br /&gt;
					_add = function(nodes, t)--children are unenhanced&lt;br /&gt;
						local HTML, nodeFunc = nodes[next], buffHTMLmeta[require].nodes&lt;br /&gt;
						for k, v in mbpairs(t) do buffHTMLmeta.__call(HTML, v~=true and v) end&lt;br /&gt;
						for k, v in mbpairs(t, false) do&lt;br /&gt;
							if htmlArg[k] then HTML[k] = v&lt;br /&gt;
							elseif v and v~=true then&lt;br /&gt;
								if nonSelf[k] then&lt;br /&gt;
									if k=='tag' then&lt;br /&gt;
										if tostring(v)==v then mwHTMLfunc.tag(HTML, v)&lt;br /&gt;
										elseif v[1] and v[1]~=true then&lt;br /&gt;
											local tag = mwHTMLfunc.tag(HTML, v[1])&lt;br /&gt;
											setmetatable(nodeFunc._add(rawset(setmetatable(tag.nodes, meta), next, tag), v), nil)[1], tag.nodes[next] = false&lt;br /&gt;
										else nodeFunc._add(HTML.nodes, v) end&lt;br /&gt;
									else buffHTMLmeta.__call(mwHTMLfunc[k](HTML), v) end--k = done/allDone&lt;br /&gt;
								elseif mwHTMLfunc[k] then&lt;br /&gt;
									if k=='node' or type(v)~='table' then mwHTMLfunc[k](HTML, v)&lt;br /&gt;
									else&lt;br /&gt;
										for _, y in mbpairs(v) do&lt;br /&gt;
											if y and y~=true then mwHTMLfunc[k](HTML, y) end&lt;br /&gt;
										end&lt;br /&gt;
										for x, y in mbpairs(v, false) do&lt;br /&gt;
											if y and y~=true then mwHTMLfunc[k](HTML, x, y) end&lt;br /&gt;
										end&lt;br /&gt;
									end&lt;br /&gt;
								else nodeFunc[k](HTML.nodes, v) end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
						return nodes&lt;br /&gt;
					end&lt;br /&gt;
				}&lt;br /&gt;
				function makeNodesBuffer(HTML)&lt;br /&gt;
					local nodes = setmetatable(HTML.nodes, meta)&lt;br /&gt;
					nodes[next], nodes.parent = HTML, HTML&lt;br /&gt;
					for k, v in next, buffHTMLmeta.__index do&lt;br /&gt;
						nodes[k] = rawset(outFuncs, k, outFuncs[k] or function(nodes, ...) return v(nodes[next], ...) end)[k]&lt;br /&gt;
					end&lt;br /&gt;
					for k, v in next, spinach do nodes[k] = v end&lt;br /&gt;
					nodes._inHTML, nodes._build = nodes.tag&lt;br /&gt;
				end&lt;br /&gt;
				for k in next, nonSelf do--any HTML objects returned by these funcs will be granted Module:Buffer enhancements&lt;br /&gt;
					local func = mwHTMLfunc[k]&lt;br /&gt;
					buffHTMLmeta.__index[k] = function(t, ...)&lt;br /&gt;
						local HTML = func(t, ...)&lt;br /&gt;
						if not (HTML.selfClosing or HTML[next]) then makeNodesBuffer(setmetatable(rawset(HTML, next, t), buffHTMLmeta)) end&lt;br /&gt;
						return HTML&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				for k, v in next, {--add new Buffer object functions&lt;br /&gt;
					getHTML = function(self, ...)&lt;br /&gt;
						buffHTMLmeta[next] = self&lt;br /&gt;
						if ... then &lt;br /&gt;
							if type(...)=='table' then return buffHTMLmeta[require](...)&lt;br /&gt;
							else return assert(buffHTMLmeta[require][...], ('&amp;quot; %s &amp;quot; does not match any mw.html function'):format(tostring(...)))(buffHTMLmeta[require], select(2, ...)) end&lt;br /&gt;
						end&lt;br /&gt;
						return buffHTMLmeta[require]&lt;br /&gt;
					end,&lt;br /&gt;
					_html = function(self, ...) return self:_(self:getHTML(), ...) end&lt;br /&gt;
				} do meta.__index[k] = v end&lt;br /&gt;
				buffHTMLmeta.__call = function(h, ...) return ... and ('table'==type(...) and spinach._add or h.nodes._)(h.nodes, ...) or h.nodes end&lt;br /&gt;
			end&lt;br /&gt;
			makeNodesBuffer(setmetatable(HTML, buffHTMLmeta))&lt;br /&gt;
			rawset(setmetatable(HTML, rawset(buffHTMLmeta, require, HTML)), next, self)&lt;br /&gt;
			return self:getHTML()&lt;br /&gt;
		end,&lt;br /&gt;
		_build = function (self, nodes) return table.insert(nodes, self()) end--for compatibility with regular mw.html objects&lt;br /&gt;
	},&lt;br /&gt;
	__call = function(t, ...)&lt;br /&gt;
		local t2 = t[rawset] and t[rawset] &amp;gt; #t and getmetatable(t)():_all(t) or t&lt;br /&gt;
		if select('#', ...)==0 then return rawset(t, 'last_concat', t.last_concat or table.concat(t2)).last_concat end&lt;br /&gt;
		return table.concat(t2, ...) or ''&lt;br /&gt;
	end,&lt;br /&gt;
	__tostring = function(t, ...)&lt;br /&gt;
		if type(t)~='table' then return t end&lt;br /&gt;
		local n, r = select('#', ...), getmetatable(t)&lt;br /&gt;
		if n &amp;gt; 1 then&lt;br /&gt;
			local k, outs, seps = 2, r[select](n, ...)&lt;br /&gt;
			r = r(t(seps[1]))&lt;br /&gt;
			while outs &amp;gt; 1 do&lt;br /&gt;
				r:_(t[next](seps[k]), 1)&lt;br /&gt;
				t, k = t[next], k + 1&lt;br /&gt;
				outs = t[next] and outs - 1 or 0&lt;br /&gt;
			end&lt;br /&gt;
			return table.concat(r, seps[k]) or ''&lt;br /&gt;
		end&lt;br /&gt;
		return t(...)&lt;br /&gt;
	end,&lt;br /&gt;
	__concat = function(a, b, Buffer)&lt;br /&gt;
		if Buffer then return error end&lt;br /&gt;
		Buffer = getmetatable(a)&lt;br /&gt;
		local us, them = pcall(Buffer and Buffer.__concat, false, next, 1)&lt;br /&gt;
		if not us or them~=error then Buffer = getmetatable(b) end&lt;br /&gt;
		return Buffer():_all{a, b}()&lt;br /&gt;
	end,&lt;br /&gt;
	__pairs = function(t, ...)--pairs always iterates in order&lt;br /&gt;
		if not map_i then&lt;br /&gt;
			local mk = {__mode='k'}&lt;br /&gt;
			map_i, map_n, map_o = setmetatable({}, mk), setmetatable({}, mk), setmetatable({}, mk)--reduces table lookups&lt;br /&gt;
			function mBuffIter(t, i) i = map_i[t][nil==i and 1 or map_n[t][i]] return i, t[i] end&lt;br /&gt;
			function mBuffOther(t, i) i = map_o[t][nil==i and 1 or map_o[t][i]] return i, t[i] end&lt;br /&gt;
			function mBuffMap(t)&lt;br /&gt;
				local ti, tn, to, n = {}, {}, {}, #t--reduces table lookups&lt;br /&gt;
				map_i[t], map_n[t], map_o[t] = ti, tn, to&lt;br /&gt;
				for k = 1, n do&lt;br /&gt;
					table.insert(ti, k)&lt;br /&gt;
					tn[k] = k + 1&lt;br /&gt;
				end&lt;br /&gt;
				if n==0 or next(t, n)~=nil then&lt;br /&gt;
					local start = next(t)==1 and n or nil&lt;br /&gt;
					for k, v in next, t, start do&lt;br /&gt;
						if tn[k] then--no op, since: t={[2]=1,[1]=2}; #t =&amp;gt; 2; next(t,#t) =&amp;gt; 1,2&lt;br /&gt;
						elseif tonumber(k)==k then table.insert(ti, k)&lt;br /&gt;
						elseif k~=t and v~=t then&lt;br /&gt;
							table.insert(to, k)&lt;br /&gt;
							to[k] = #to + 1&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					if #ti~=n then&lt;br /&gt;
						table.sort(ti)&lt;br /&gt;
						for k, v in next, ti do tn[v] = k + 1 end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if select('#', ...)==0 or ...==true then mBuffMap(t) end&lt;br /&gt;
		return ...==nil and mBuffIter or mBuffOther, t&lt;br /&gt;
	end,&lt;br /&gt;
	__ipairs = pairs&lt;br /&gt;
},{__tostring = function()return''end,&lt;br /&gt;
	__call = function(self, ...)&lt;br /&gt;
		if not rawget(_G, 'libFunc') then--adds string and mw libraries; also add global functions if passed; rawget avoids error when reading nil global&lt;br /&gt;
			rawset(_G, 'libFunc', {__call = function(t, self, ...) return t[1](type(self)~='table' and self or self:_str(), ...) end})&lt;br /&gt;
			for _, library in ipairs{mw.text, string, mw.ustring} do&lt;br /&gt;
				for k, func in pairs(library) do self.__index[library==mw.ustring and k .. '_' or k] = setmetatable({func}, libFunc) end&lt;br /&gt;
			end&lt;br /&gt;
			rawset(_G, 'new_G', ... and type(...)=='table' and (...)._G==... and ...~=_G and (...).mw and (...).mw.log==mw.log and ...)&lt;br /&gt;
			if new_G then&lt;br /&gt;
				rawset(_G, 'gfuncs', {--stored as global for Buffer:_inHTML&lt;br /&gt;
					_G = function(self, name, var)&lt;br /&gt;
						if rawget(new_G, name) then &lt;br /&gt;
							local metaG = getmetatable(new_G)&lt;br /&gt;
							if not metaG then&lt;br /&gt;
								metaG = {__index = {}}&lt;br /&gt;
								setmetatable(new_G, metaG)&lt;br /&gt;
							end&lt;br /&gt;
							metaG.__index[name] = new_G[name]&lt;br /&gt;
						end&lt;br /&gt;
						new_G[name] = var or self&lt;br /&gt;
						return self&lt;br /&gt;
					end,&lt;br /&gt;
					_R = function(self, name, var) new_G[name] = var return self end,&lt;br /&gt;
					_B = function(self, var) return var or var~=false and self end&lt;br /&gt;
				})&lt;br /&gt;
				for k, v in pairs(gfuncs) do self.__index[k] = v end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if new_G and ... and (...)==new_G then--avoid error when passing _G to buffer a second time&lt;br /&gt;
			local new, name = setmetatable({}, self), select(2, ...)&lt;br /&gt;
			if name and type(name)=='string' then new_G[name] = new end&lt;br /&gt;
			return new&lt;br /&gt;
		end&lt;br /&gt;
		return setmetatable({}, self):_(...)&lt;br /&gt;
	end,&lt;br /&gt;
	__index = function(t, i)&lt;br /&gt;
		return function(...) return t.__index[i](t(), select(2,...)) end&lt;br /&gt;
	end&lt;br /&gt;
})&lt;/div&gt;</summary>
		<author><name>Codehydro</name></author>	</entry>

	</feed>