mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
e9e1c41060
commit
8a597a484b
|
@ -15,14 +15,14 @@ local function typeconv(desttypeval, val)
|
|||
elseif val == "no" then
|
||||
val = false
|
||||
else
|
||||
msg.error("Error: Can't convert " .. val .. " to boolean!")
|
||||
msg.error("Error: Can't convert '" .. val .. "' to boolean!")
|
||||
val = nil
|
||||
end
|
||||
elseif type(desttypeval) == "number" then
|
||||
if not (tonumber(val) == nil) then
|
||||
val = tonumber(val)
|
||||
else
|
||||
msg.error("Error: Can't convert " .. val .. " to number!")
|
||||
msg.error("Error: Can't convert '" .. val .. "' to number!")
|
||||
val = nil
|
||||
end
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ local function read_options(options, identifier, on_update)
|
|||
-- match found values with defaults
|
||||
if option_types[key] == nil then
|
||||
msg.warn(conffilename..":"..linecounter..
|
||||
" unknown key " .. key .. ", ignoring")
|
||||
" unknown key '" .. key .. "', ignoring")
|
||||
else
|
||||
local convval = typeconv(option_types[key], val)
|
||||
if convval == nil then
|
||||
|
|
Loading…
Reference in New Issue