local z={}local function U(U,Q)if type(U)~="\110\105\108"and type(U)~="\116\097\098\108\101"then print("\070\097\105\108\101\100 \116\111 \099\111\110\115\116\114\117\099\116 \097 \099\111\108\111\114\115\101\116\033 \065\114\103 \035\049 \"\099\111\108\111\114\115\" \115\104\111\117\108\100 \098\101 \097 \110\105\108 \111\114 \097 \116\097\098\108\101\033")end if type(Q)~="\110\105\108"and type(Q)~="\116\097\098\108\101"then print("\070\097\105\108\101\100 \116\111 \099\111\110\115\116\114\117\099\116 \097 \099\111\108\111\114\115\101\116\033 \065\114\103 \035\049 \"\104\101\105\103\104\116\095\100\101\115\116\114\105\098\117\116\105\111\110\" \115\104\111\117\108\100 \098\101 \097 \110\105\108 \111\114 \097 \116\097\098\108\101\033")end local M={}M.colors=U or{}M.height_destribution=Q or{}return setmetatable(M,{__index=z})end function z.pickColor(z,U)local Q=1 for z,M in pairs(z.height_destribution)do if U<z and z<Q then Q=z end end return z.colors[z.height_destribution[Q]]end return setmetatable({new=U},{__newindex=function()error("\067\111\108\111\114\115\101\116\058 \065\116\116\101\109\112\116 \116\111 \101\100\105\116 \097 \114\101\097\100-\111\110\108\121 \119\114\097\112\112\101\114\033 \077\097\107\101 \115\117\114\101 \116\104\097\116 \121\111\117 \099\114\101\097\116\101 \097 \110\101\119 \111\098\106\101\099\116 \102\105\114\115\116")end})
local ColorsetBase = {}

local function object_constructor(colors,height_destribution)
	if type(colors) ~= "nil" and type(colors) ~= "table" then
		print('Failed to construct a colorset! Arg #1 "colors" should be a nil or a table!')
	end

	if type(height_destribution) ~= "nil" and type(height_destribution) ~= "table" then
		print('Failed to construct a colorset! Arg #1 "height_destribution" should be a nil or a table!')
	end

	local object = {}
	object.colors = colors or {}
	object.height_destribution = height_destribution or {}

	return setmetatable(object,{__index = ColorsetBase})
end

function ColorsetBase.pickColor(self,value)
	local lowest = 1
	for height,color in pairs(self.height_destribution) do
		if value < height and height < lowest then
			lowest = height
		end
	end

	return self.colors[self.height_destribution[lowest]]
end

return setmetatable(
	{new = object_constructor},
	{__newindex = function()
		error("Colorset: Attempt to edit a read-only wrapper! Make sure that you create a new object first")
	end}
)