As a plugin developer, it is currently too hard to erase or forget settings saved through plugin:SetSetting()
. Attempting to simply over-write the existing setting with nil
will throw an error and not change the data.
Presently, the only option is it over-write it with some identifier to signal that it shouldn’t be used (for example, my plugin uses the string “STT_DELETED”) but this requires additional code in other areas to not only compare it to nil
, but to the identifier as well. Also, it makes it a pain to edit the JSON file, because it’s full of unused settings.
To fix this issue, I’d suggest adding plugin:DestroySetting(key)
, a function that would, as the name suggests, destroy the setting, removing the key and its value from the JSON file.
My personal use case is for adding a “clear all preferences” feature to my time tracker plugin. When bad or malformed data gets saved, it’s possible to remove it by editing the JSON file, but that can be tricky, and a pretty bad user experience-having a way to do it through code would be much better.
Edit: Implemented as of version 406! Dreams DO come true!