<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FMatroc%2FStr_swap</id>
	<title>Module:Sandbox/Matroc/Str swap - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2FMatroc%2FStr_swap"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Matroc/Str_swap&amp;action=history"/>
	<updated>2026-04-21T06:19:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/Matroc/Str_swap&amp;diff=145798&amp;oldid=prev</id>
		<title>imported&gt;Matroc: Create Lua test module to swap string</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Matroc/Str_swap&amp;diff=145798&amp;oldid=prev"/>
		<updated>2013-06-28T05:45:29Z</updated>

		<summary type="html">&lt;p&gt;Create Lua test module to swap string&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.swapreplace(frame)&lt;br /&gt;
    local a_string = frame.args[1] or &amp;quot;&amp;quot;&lt;br /&gt;
       if a_string == nil  or a_string == &amp;quot;&amp;quot; then&lt;br /&gt;
         error(&amp;quot;Missing string on which to perform swap!&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
    local noofargs = 0&lt;br /&gt;
       for i = 1, 10, 1 do&lt;br /&gt;
          if frame.args[i] ~= nil then&lt;br /&gt;
            noofargs = i&lt;br /&gt;
           end -- END if&lt;br /&gt;
        end -- END for&lt;br /&gt;
&lt;br /&gt;
       if noofargs ~= 4 then&lt;br /&gt;
         error(&amp;quot;Incorrect number of arguments: &amp;quot; .. noofargs .. &amp;quot; Required = 4!&amp;quot;)&lt;br /&gt;
        end -- END if&lt;br /&gt;
&lt;br /&gt;
    local nooftimes = tonumber(frame.args[4])&lt;br /&gt;
&lt;br /&gt;
       if nooftimes == nil then&lt;br /&gt;
              nooftimes = 1&lt;br /&gt;
          elseif nooftimes == &amp;quot;&amp;quot; then&lt;br /&gt;
              nooftimes = 1&lt;br /&gt;
          elseif nooftimes &amp;lt;= 0 then&lt;br /&gt;
              nooftimes = 1&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
    local swap = frame.args[2] or &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
          if swap == nil then&lt;br /&gt;
             swap = &amp;quot;&amp;quot;&lt;br /&gt;
           end&lt;br /&gt;
&lt;br /&gt;
          if swap == &amp;quot;&amp;quot; then&lt;br /&gt;
             error(&amp;quot;Missing String to Swap!&amp;quot;)&lt;br /&gt;
           end&lt;br /&gt;
&lt;br /&gt;
    local swapwith = frame.args[3] or &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
          if swapwith == nil then&lt;br /&gt;
             swapwith = &amp;quot;&amp;quot;&lt;br /&gt;
           end&lt;br /&gt;
&lt;br /&gt;
          if swapwith == &amp;quot;&amp;quot; then&lt;br /&gt;
             error(&amp;quot;Missing String to Swap with!&amp;quot;)&lt;br /&gt;
           end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     a_string = (a_string:gsub(swap,&amp;quot;@2@2&amp;quot; .. swap .. &amp;quot;@2@2&amp;quot;, nooftimes)) &lt;br /&gt;
     a_string = (a_string:gsub(swapwith,&amp;quot;@3@3&amp;quot; .. swapwith .. &amp;quot;@3@3&amp;quot;, nooftimes))&lt;br /&gt;
     a_string = (a_string:gsub(&amp;quot;@3@3&amp;quot; .. swapwith .. &amp;quot;@3@3&amp;quot;, swap, nooftimes))&lt;br /&gt;
     a_string = (a_string:gsub(&amp;quot;@2@2&amp;quot; .. swap .. &amp;quot;@2@2&amp;quot;, swapwith, nooftimes))&lt;br /&gt;
&lt;br /&gt;
  return a_string&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Matroc</name></author>
	</entry>
</feed>