local I=script.Parent local t=I.Parent local c=require(t.t)local Z=c.optional(c.integer)local s=c.tuple(c.table,Z,Z)local function J(I,t,c)assert(s(I,t,c))local Z=#I t=t or 1 c=c or Z if t<1 then t=Z+t end if c<1 then c=Z+c end assert(t>0 and t<=Z+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,Z))assert(c>0 and c<=Z+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",c,Z))assert(t<=c,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",t,c))local J={}local r=1 for t=t,c,1 do J[r]=I[t]r=r+1 end return J end return J
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 slice(list, from, to)
	assert(validate(list, from, to))
	
	local len = #list

	from = from or 1
	to = to or len

	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 = from, to do
		new[index] = list[i]
		index = index + 1
	end

	return new
end

return slice