Skip to content

Add can_change for console variables

Lactozilla requested to merge cv-can-change into next

What it says on the tin

CV_RegisterVar({
	name = "no_number_november",
	defaultvalue = "abc",
	flags = CV_CALL,
	func = function(cv)
		print("Changed " .. cv.name .. " to " .. cv.string)
	end,
	can_change = function(cv, valstr)
		if valstr:match("%d+") then
			print("Cannot change " .. cv.name .. " to " .. valstr)
			return false
		end
		return true
	end
})

Merge request reports