aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRogier <rogier777@gmail.com>2016-01-07 20:59:35 +0100
committerparamat <mat.gregory@virginmedia.com>2016-01-10 01:03:06 +0000
commit31ac53dfd0eb0ab1e42921e85cf6575a16cbc38e (patch)
tree1c7f121724beaed2bda8c754b83f420eab20a091
parent58babf8b1945f1a2db0180a4a3ed7b0d52872bef (diff)
downloadminetest-31ac53dfd0eb0ab1e42921e85cf6575a16cbc38e.tar.gz
minetest-31ac53dfd0eb0ab1e42921e85cf6575a16cbc38e.tar.bz2
minetest-31ac53dfd0eb0ab1e42921e85cf6575a16cbc38e.zip
Fix the checking of flags values in the settings tab
Changes: - Accept setting an empty flags-type value in the settings tab if the variable specification permits it - Don't accept substrings of flag values E.g. with values: 'one,two,three', 'hree', 'w', etc. used to be accepted. Not any more - Don't accept flags with random pattern-matching special characters E.g. with values: 'one,two,three', 'on.', '(o)[n]e*' etc. used to be accepted. Not any more.
-rw-r--r--builtin/mainmenu/tab_settings.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua
index f3a09a985..472becea2 100644
--- a/builtin/mainmenu/tab_settings.lua
+++ b/builtin/mainmenu/tab_settings.lua
@@ -506,8 +506,8 @@ local function handle_change_setting_buttons(this, fields)
local new_value = fields["te_setting_value"]
for _,value in ipairs(new_value:split(",", true)) do
value = value:trim()
- if not value:match(CHAR_CLASSES.FLAGS .. "+")
- or not setting.possible:match("[,]?" .. value .. "[,]?") then
+ local possible = "," .. setting.possible .. ","
+ if not possible:find("," .. value .. ",", 0, true) then
this.data.error_message = fgettext_ne("\"$1\" is not a valid flag.", value)
this.data.entered_text = fields["te_setting_value"]
core.update_formspec(this:get_formspec())