Let GET_RESOURCE_KVP_* have a default value

Currently using GET_RESOURCE_KVP_* you have to handle if the kvp isn’t set, which is fine for GetResourceKvpString as it defaults to nil, but trying to use it with GetResourceKvpInt which defaults to 0, it ruins one of the use cases that I wanted to use it for, as I wanted to use it as a boolean, which is default to true, but there’s no way to tell if it got set to 0 as default or by the end user.

What I’m proposing is basically exactly like GetConvarInt, where the first argument is the convar and the second is the default value

Example:
GetResourceKvpInt('pma-voice_enableRadioClicks', 1)

3 Likes

I know this is old, but any workarounds?
I could really use the option to set a default value…

1 Like

Bump. The GetResourceKvpFloat function also has this issue, as it returns 0.0 when unset, making it impossible to distinguish between an unset value and one that is explicitly set to 0.0.

I just published a pull request!

1 Like