function t.array(r)assert(t.callback(r))local z=t.values(r)return function(r)local u=arrayKeysCheck(r)if u==false then return false end local N=0 for r in ipairs(r)do N=N+1 end for r in pairs(r)do if r<1 or r>N then return false end end local W=z(r)if not W then return false end return true end end

	function t.array(check)
		assert(t.callback(check))
		local valuesCheck = t.values(check)

		return function(value)
			local keySuccess = arrayKeysCheck(value)
			if keySuccess == false then
				return false
			end

			-- # is unreliable for sparse arrays
			-- Count upwards using ipairs to avoid false positives from the behavior of #
			local arraySize = 0

			for _ in ipairs(value) do
				arraySize = arraySize + 1
			end

			for key in pairs(value) do
				if key < 1 or key > arraySize then
					return false
				end
			end

			local valueSuccess = valuesCheck(value)
			if not valueSuccess then
				return false
			end

			return true
		end
	end
