local j=script.Parent local g=j.Parent local B=require(g.t)local N=B.tuple(B.table,B.optional(B.intersection(B.integer,B.numberMin(0))))local function f(j,g)assert(N(j))local B={}local i=1 for j,N in ipairs(j)do if type(N)=="\116\097\098\108\101"and(not g or g>0)then local j=f(N,g and g-1)for g=1,#j,1 do B[i]=j[g]i=i+1 end else B[i]=N i=i+1 end end return B end return f
local List = script.Parent

local Llama = List.Parent
local t = require(Llama.t)

local validate = t.tuple(t.table, t.optional(t.intersection(t.integer, t.numberMin(0))))

local function flatten(list, depth)
	assert(validate(list))
	
	local new = {}
	local index = 1

	for _, v in ipairs(list) do
		if type(v) == "table" and (not depth or depth > 0) then
			local subList = flatten(v, depth and depth - 1)

			for j = 1, #subList do
				new[index] = subList[j]
				index = index + 1
			end
		else
			new[index] = v
			index = index + 1
		end
	end

	return new
end

return flatten