mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Advanced settings: Add range check for float type
This commit is contained in:
parent
026ad912af
commit
4e652ea9dd
@ -752,6 +752,18 @@ local function handle_change_setting_buttons(this, fields)
|
|||||||
core.update_formspec(this:get_formspec())
|
core.update_formspec(this:get_formspec())
|
||||||
return true
|
return true
|
||||||
end
|
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)
|
core.settings:set(setting.name, new_value)
|
||||||
|
|
||||||
elseif setting.type == "flags" then
|
elseif setting.type == "flags" then
|
||||||
|
Loading…
Reference in New Issue
Block a user