local function N(N,C,D)local Z={}local j=#N assert(C<=j,"\105\110\100\101\120 \109\117\115\116 \098\101 \108\101\115\115 \111\114 \101\113\117\097\108 \116\104\097\110 \116\104\101 \108\105\115\116 \108\101\110\103\116\104")for j=1,j,1 do if j==C then Z[j]=D else Z[j]=N[j]end end return Z end return N
--[[
	Returns a new list with the new value replaced at the given index.
]]

local function replaceIndex(list, index, value)
	local new = {}
	local len = #list

	assert(index <= len, "index must be less or equal than the list length")

	for i = 1, len do
		if i == index then
			new[i] = value
		else
			new[i] = list[i]
		end
	end

	return new
end

return replaceIndex
