This makes it easier to understand the error in cases of incorrect syntax or formatting at .conf files. (js already has this quoting). Fixes #9105
Showing the changes to player/lua/options.lua (1 of 1 file). Show all
Unified · Split
| @@ -15,14 +15,14 @@ local function typeconv(desttypeval, val) · 14 unmodified lines | |||
| 15 | elseif val == "no" then | 15 | elseif val == "no" then |
| 16 | val = false | 16 | val = false |
| 17 | else | 17 | else |
| 18 | msg.error("Error: Can't convert " .. val .. " to boolean!") | 18 | msg.error("Error: Can't convert '" .. val .. "' to boolean!") |
| 19 | val = nil | 19 | val = nil |
| 20 | end | 20 | end |
| 21 | elseif type(desttypeval) == "number" then | 21 | elseif type(desttypeval) == "number" then |
| 22 | if not (tonumber(val) == nil) then | 22 | if not (tonumber(val) == nil) then |
| 23 | val = tonumber(val) | 23 | val = tonumber(val) |
| 24 | else | 24 | else |
| 25 | msg.error("Error: Can't convert " .. val .. " to number!") | 25 | msg.error("Error: Can't convert '" .. val .. "' to number!") |
| 26 | val = nil | 26 | val = nil |
| 27 | end | 27 | end |
| 28 | end | 28 | end |
| @@ -92,7 +92,7 @@ local function read_options(options, identifier, on_update) · 63 unmodified lines | |||
| 92 | -- match found values with defaults | 92 | -- match found values with defaults |
| 93 | if option_types[key] == nil then | 93 | if option_types[key] == nil then |
| 94 | msg.warn(conffilename..":"..linecounter.. | 94 | msg.warn(conffilename..":"..linecounter.. |
| 95 | " unknown key " .. key .. ", ignoring") | 95 | " unknown key '" .. key .. "', ignoring") |
| 96 | else | 96 | else |
| 97 | local convval = typeconv(option_types[key], val) | 97 | local convval = typeconv(option_types[key], val) |
| 98 | if convval == nil then | 98 | if convval == nil then |