local function p(p,d,T)local J=type(p)assert(J=="\116\097\098\108\101","\101\120\112\101\099\116\101\100 \097 \116\097\098\108\101 \102\111\114 \102\105\114\115\116 \097\114\103\117\109\101\110\116\044 \103\111\116 "..J)local C=#p assert(d<=C,"\105\110\100\101\120 \109\117\115\116 \098\101 \108\101\115\115 \116\104\097\110 \111\114 \101\113\117\097\108 \116\111 \116\104\101 \108\105\115\116 \108\101\110\103\116\104")assert(d>=1,"\105\110\100\101\120 \109\117\115\116 \098\101 \103\114\101\097\116\101\114 \116\104\097\110 \111\114 \101\113\117\097\108 \116\111 \049")local O={}local s=1 for J=1,C,1 do if J==d then O[s]=T else O[s]=p[J]end s=s+1 end return O end return p

local function set(list, index, value)
	local listType = type(list)
	assert(listType == "table", "expected a table for first argument, got " .. listType)
	
	local len = #list

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

	local new = {}
	local resultIndex = 1

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

		resultIndex = resultIndex + 1
	end

	return new
end

return set