Skip to content

Let Lua cvars use preset values in addition to MIN and MAX

James R. requested to merge lua-minmax-plus into next

This is functionality that is already present in hardcode, but that Lua could not take advantage of due to preset values being allocated with a table. (Table keys do not have guaranteed order in Lua.)

Try it out:

CV_RegisterVar({ 'yes', '1', CV_NETVAR, {
	MIN = 1,
	MAX = 99,
	chad = 0,
}})

Additionally, this branch disallows cvars to be registered if they have only one of the MIN or MAX values. This is implied to not be allowed in the code anyway.

Merge request reports