cortav  Diff

Differences From Artifact [dc1f0ae1fb]:

To Artifact [4b787982a7]:


   885    885   				end
   886    886   			else
   887    887   				me:react(sym)
   888    888   			end
   889    889   		end;
   890    890   	};
   891    891   }
          892  +
          893  +-- convenience buffer for holding strings under
          894  +-- construction, accumulating and compiling then in
          895  +-- as quick a way as lua permits
          896  +ss.strac = ss.declare {
          897  +	ident = 'string-accumulator';
          898  +	mk = function() return {
          899  +		strs = {};
          900  +		strc = 0;
          901  +		plain = true;
          902  +	} end;
          903  +	call = function(self, s, ...)
          904  +		if s == nil then return end
          905  +		self.strc = self.strc + 1
          906  +		self.strs[self.strc] = s
          907  +		if type(s) ~= 'string' then self.plain = false end
          908  +		self(...)
          909  +	end;
          910  +	cast = {
          911  +		string = function(self)
          912  +			return self:compile()
          913  +		end;
          914  +	};
          915  +	fns = {
          916  +		compile = function(self, delim)
          917  +			if self.plain then
          918  +				return table.concat(self.strs, delim)
          919  +			end
          920  +			local tbl = {}
          921  +			local function delve(a)
          922  +				for i=1,a.strc do
          923  +					local s = a.strs[i]
          924  +					if type(s) == 'string' then
          925  +						table.insert(tbl, s)
          926  +					elseif ss.strac.is(s) then
          927  +						delve(s)
          928  +					elseif s ~= nil then
          929  +						table.insert(tbl, tostring(s))
          930  +					end
          931  +				end
          932  +			end
          933  +			delve(self)
          934  +			return table.concat(tbl, delim)
          935  +		end;
          936  +		wrap = function(self,a,b)
          937  +			table.insert(self.strs, 1, a)
          938  +			table.insert(self.strs, b)
          939  +		end;
          940  +	};
          941  +}