function module.CountMapEntries(V)local q=0 for V in pairs(V)do q=q+1 end return q end module.newLayeredTable=(require(script.LayeredTable)).new module.newReadOnlyWrapper=(require(script.ReadOnlyWrapper)).new function module.AddTableToTable(V,q)local d={}for V,g in pairs(V)do d[V]=g+q[V]end return d end function module.AddNumberToTable(V,q)local d={}for q,g in pairs(q)do d[q]=g+V end return d end function module.Add(...)local V={...}for q=#V-1,1,-1 do local d=V[q+1]local g=V[q]if type(d)=="\116\097\098\108\101"then if type(g)=="\116\097\098\108\101"then V[q]=module.AddTableToTable(d,g)else V[q]=module.AddNumberToTable(g,d)end else if type(g)=="\116\097\098\108\101"then V[q]=module.AddNumberToTable(d,g)else V[q]=d*g end end end return V[1]end function module.MultiplyTableByTable(V,q)local d={}for g=1,#V,1 do d[g]=V[g]*q[g]end return d end function module.MultiplyNumberByTable(V,q)local d={}for g=1,#q,1 do d[g]=q[g]*V end return d end function module.Multiply(V,q)if type(V)=="\116\097\098\108\101"then if type(q)=="\110\117\109\098\101\114"then return module.MultiplyNumberByTable(q,V)elseif type(q)=="\116\097\098\108\101"then return module.MultiplyTableByTable(V,q)else Utils.Log.AssertNonNilAndType("\097\114\103\117\109\101\110\116 \050","\116\097\098\108\101 \111\114 \110\117\109\098\101\114",q)end elseif type(V)=="\110\117\109\098\101\114"then if type(q)=="\116\097\098\108\101"then return module.MultiplyNumberByTable(V,q)else Utils.Log.AssertNonNilAndType("\097\114\103\117\109\101\110\116 \050","\116\097\098\108\101",q)end end end local function V(V,q,d)local g={}if d>0 then local P=V while P<q do g[#g+1]=P P=P+d end elseif d<0 then local P=V while P>q do g[#g+1]=P P=P+d end end return g end function module.Range(q,d,g)if q and(d and g)then return V(q,d,g)elseif q and d then return V(q,d,1)elseif q then return V(0,q,1)else return{}end end function module.RangeInclusive(V,q,d)return module.Range(V,q+d/2,d)end

function module.CountMapEntries(t)
	local n = 0;
	for i in pairs(t) do
		n = n + 1;
	end
	return n;
end

module.newLayeredTable = require(script.LayeredTable).new;
module.newReadOnlyWrapper = require(script.ReadOnlyWrapper).new;

function module.AddTableToTable(t1, t2)
	local output = {};
	for i, v in pairs(t1) do
		output[i] = v + t2[i];
	end
	return output;
end
function module.AddNumberToTable(n, t)
	local output = {};
	for i, v in pairs(t) do
		output[i] = v + n;
	end
	return output;
end
function module.Add(...)
	local AddQueue = {...};
	--Peel off the last two elements and add them.
	for i = #AddQueue - 1, 1, -1 do
		local a = AddQueue[i + 1];
		local b = AddQueue[i];
		if type(a) == 'table' then
			if type(b) == 'table' then
				AddQueue[i] = module.AddTableToTable(a, b);
			else
				AddQueue[i] = module.AddNumberToTable(b, a);
			end
		else
			if type(b) == 'table' then
				AddQueue[i] = module.AddNumberToTable(a, b);
			else
				AddQueue[i] = a * b;
			end
		end
	end
	return AddQueue[1];
end

function module.MultiplyTableByTable(t1, t2)
	local output = {};
	for i = 1, #t1 do
		output[i] = t1[i] * t2[i];
	end
	return output;
end
function module.MultiplyNumberByTable(n, t)
	local output = {};
	for i = 1, #t do
		output[i] = t[i] * n;
	end
	return output;
end
function module.Multiply(t1, t2)
	if type(t1) == 'table' then
		if type(t2) == 'number' then
			return module.MultiplyNumberByTable(t2, t1);
		elseif type(t2) == 'table' then
			return module.MultiplyTableByTable(t1, t2);
		else
			Utils.Log.AssertNonNilAndType("argument 2", "table or number", t2);
		end
	elseif type(t1) == 'number' then
		if type(t2) == 'table' then
			return module.MultiplyNumberByTable(t1, t2);
		else
			Utils.Log.AssertNonNilAndType("argument 2", "table", t2);
		end
	end
end

local function rawRange(start, stop, step)
	local output = {};
	if step > 0 then
		local i = start;
		while i < stop do
			output[#output + 1] = i;
			i = i + step;
		end
	elseif step < 0 then
		local i = start;
		while i > stop do
			output[#output + 1] = i;
			i = i + step;
		end
	end
	return output;
end
function module.Range(start, stop, step)
	if start and stop and step then
		return rawRange(start, stop, step);
	elseif start and stop then
		return rawRange(start, stop, 1);
	elseif start then
		return rawRange(0, start, 1);
	else
		return {};
	end
end

function module.RangeInclusive(start, stop, step)
	return module.Range(start, stop + step/2, step);
end
