local v=script.Parent local E=v.Parent local L=require(E.t)local C=L.optional(L.integer)local p=L.tuple(L.table,C,C)local function s(v,E,L,...)assert(p(v,E,L))local C=#v E=E or 1 L=L or C+1 if E<1 then E=C+E end if L<1 then L=C+L end assert(E>0 and E<=C+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",E,C))assert(L>0 and L<=C+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",L,C))assert(E<=L,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",E,L))local s={}local x=1 for E=1,E-1,1 do s[x]=v[E]x=x+1 end for v=1,select("\035",...),1 do s[x]=select(v,...)x=x+1 end for E=L+1,C,1 do s[x]=v[E]x=x+1 end return s end return s
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