Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Advanced settings: Add range check for float type
- Loading branch information
Showing
with
12 additions
and
0 deletions.
-
+12
−0
builtin/mainmenu/dlg_settings_advanced.lua
|
@@ -752,6 +752,18 @@ local function handle_change_setting_buttons(this, fields) |
|
|
core.update_formspec(this:get_formspec()) |
|
|
return true |
|
|
end |
|
|
if setting.min and new_value < setting.min then |
|
|
this.data.error_message = fgettext_ne("The value must be at least $1.", setting.min) |
|
|
this.data.entered_text = fields["te_setting_value"] |
|
|
core.update_formspec(this:get_formspec()) |
|
|
return true |
|
|
end |
|
|
if setting.max and new_value > setting.max then |
|
|
this.data.error_message = fgettext_ne("The value must not be larger than $1.", setting.max) |
|
|
this.data.entered_text = fields["te_setting_value"] |
|
|
core.update_formspec(this:get_formspec()) |
|
|
return true |
|
|
end |
|
|
core.settings:set(setting.name, new_value) |
|
|
|
|
|
elseif setting.type == "flags" then |
|
|