-- Purely for number returning functions.

-- Determine the numeric amount of values in a table by stitching together location entries from a template.
local function LookupTemplateListLength(intbl,...)
	local location = {...}
	local outnum
	for i=1, TableLength(intbl) do
		-- Ignore the item, just focus on the locations
		for j=2,TableLength(intbl[i]) do
			local innum
			if ArgsLength(...) > 0 then
				if IsTableToBool(intbl[i][j]) then
				if NumericTablePairMatchToBool(location,intbl[i][j],nil,true) and IsToBool(TableLength(intbl[i][j]),Add(TableLength(location),1)) then
					innum = MatchReplace(intbl[i][j][ArgsLength(...)+1],0)
				end
					innum = 0
				end
			else
				innum = Select(IsNumberToBool(ValueUnpack(intbl[i][j])),ValueUnpack(intbl[i][j]),0)
			end
			if outnum == nil then
				outnum = innum
			elseif innum > outnum then
				outnum = innum
			end
		end
	end
	return MatchReplace(outnum,0)
end
