local f=script.Parent local u=f.Parent local T=require(u.t)local J=T.optional(T.integer)local i=T.tuple(T.table,J,J)local function W(f,u,T,...)assert(i(f,u,T))local J=#f u=u or 1 T=T or J+1 if u<1 then u=J+u end if T<1 then T=J+T end assert(u>0 and u<=J+1,string.format("\105\110\100\101\120 \037\100 \111\117\116 \111\102 \098\111\117\110\100\115 \111\102 \108\105\115\116 \111\102 \108\101\110\103\116\104 \037\100",u,J))assert(T>0 and T<=J+1,string.format("\105\110\100\101\120 \037\100 \111\117\116 \111\102 \098\111\117\110\100\115 \111\102 \108\105\115\116 \111\102 \108\101\110\103\116\104 \037\100",T,J))assert(u<=T,string.format("\115\116\097\114\116 \105\110\100\101\120 \037\100 \099\097\110\110\111\116 \098\101 \103\114\101\097\116\101\114 \116\104\097\110 \101\110\100 \105\110\100\101\120 \037\100",u,T))local W={}local F=1 for u=1,u-1,1 do W[F]=f[u]F=F+1 end for f=1,select("\035",...),1 do W[F]=select(f,...)F=F+1 end for u=T+1,J,1 do W[F]=f[u]F=F+1 end return W end return W
local List = script.Parent

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

local indexType = t.optional(t.integer)
local validate = t.tuple(t.table, indexType, indexType)

local function splice(list, from, to, ...)
	assert(validate(list, from, to))
	
	local len = #list

	from = from or 1
	to = to or len + 1

	if from < 1 then
		from = len + from
	end

	if to < 1 then
		to = len + to
	end

	assert(from > 0 and from <= len + 1, string.format("index %d out of bounds of list of length %d", from, len))
	assert(to > 0 and to <= len + 1, string.format("index %d out of bounds of list of length %d", to, len))
	assert(from <= to, string.format("start index %d cannot be greater than end index %d", from, to))

	local new = {}
	local index = 1

	for i = 1, from - 1 do
		new[index] = list[i]
		index = index + 1
	end

	for i = 1, select('#', ...) do
		new[index] = select(i, ...)
		index = index + 1
	end

	for i = to + 1, len do
		new[index] = list[i]
		index = index + 1
	end

	return new
end

return splice