History

lua: read_options: quote values at error messages

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

Avi Halachmi (:avih) committed 5 years ago

Commit 8a597a41 parent e9e1c411 file · +3 −3Browse files

Showing the changes to player/lua/options.lua (1 of 1 file). Show all

Unified · Split

player/lua/options.lua+3−3
@@ -15,14 +15,14 @@ local function typeconv(desttypeval, val) · 14 unmodified lines
1515 elseif val == "no" then
1616 val = false
1717 else
18− msg.error("Error: Can't convert " .. val .. " to boolean!")
18+ msg.error("Error: Can't convert '" .. val .. "' to boolean!")
1919 val = nil
2020 end
2121 elseif type(desttypeval) == "number" then
2222 if not (tonumber(val) == nil) then
2323 val = tonumber(val)
2424 else
25− msg.error("Error: Can't convert " .. val .. " to number!")
25+ msg.error("Error: Can't convert '" .. val .. "' to number!")
2626 val = nil
2727 end
2828 end
@@ -92,7 +92,7 @@ local function read_options(options, identifier, on_update) · 63 unmodified lines
9292 -- match found values with defaults
9393 if option_types[key] == nil then
9494 msg.warn(conffilename..":"..linecounter..
95− " unknown key " .. key .. ", ignoring")
95+ " unknown key '" .. key .. "', ignoring")
9696 else
9797 local convval = typeconv(option_types[key], val)
9898 if convval == nil then

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t