local I=script.Parent local t=I.Parent local c=require(t.t)local Z=c.tuple(c.table,c.callback,c.optional(c.integer))local function s(I,t,c)assert(Z(I,t,c))local s=#I if s<=0 then return nil end c=c or s if c<1 then c=s+c end assert(c>0 and c<=s+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,s))for c=c,1,-1 do if t(I[c],c)then return c end end return nil end return s
local List = script.Parent

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

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

local function findWhereLast(list, predicate, from)
	assert(validate(list, predicate, from))

	local len = #list

	if len <= 0 then
		return nil
	end

	from = from or len

	if from < 1 then
		from = len + from
	end

	assert(from > 0 and from <= len + 1, string.format("index %d out of bounds of list of length %d", from, len))
	
	for i = from, 1, -1 do
		if predicate(list[i], i) then
			return i
		end
	end

	return nil
end

return findWhereLast