From c6fa952d198c87e97ce79467376abdf7f3f896db Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 2 Oct 2024 06:43:01 -0700 Subject: [PATCH] convert numeric strings to numbers for numeric preferences --- changelog.txt | 1 + internal/control-panel/common.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/changelog.txt b/changelog.txt index 7507a87ba1..b58d36042f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -32,6 +32,7 @@ Template for new versions: ## Fixes - `gui/quickfort`: only print a help blueprint's text once even if the repeat setting is enabled +- `control-panel`: fix setting numeric preferences from the commandline ## Misc Improvements - `control-panel`: Add realistic-melting tweak to control-panel registry diff --git a/internal/control-panel/common.lua b/internal/control-panel/common.lua index 21472c45c1..df4e9f6f7a 100644 --- a/internal/control-panel/common.lua +++ b/internal/control-panel/common.lua @@ -180,6 +180,9 @@ function set_preference(data, in_value) if expected_type == 'boolean' and type(value) ~= 'boolean' then value = argparse.boolean(value) end + if expected_type == "number" then + value = tonumber(value) + end local actual_type = type(value) if actual_type ~= expected_type then qerror(('"%s" has an unexpected value type: got: %s; expected: %s'):format(