summaryrefslogtreecommitdiffstats
path: root/player/lua/options.lua
diff options
context:
space:
mode:
Diffstat (limited to 'player/lua/options.lua')
-rw-r--r--player/lua/options.lua17
1 files changed, 5 insertions, 12 deletions
diff --git a/player/lua/options.lua b/player/lua/options.lua
index 1ea0d7226c..b05b73427b 100644
--- a/player/lua/options.lua
+++ b/player/lua/options.lua
@@ -1,12 +1,5 @@
local msg = require 'mp.msg'
-local function val2str(val)
- if type(val) == "boolean" then
- if val then val = "yes" else val = "no" end
- end
- return val
-end
-
-- converts val to type of desttypeval
local function typeconv(desttypeval, val)
if type(desttypeval) == "boolean" then
@@ -15,14 +8,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
+ if 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 +85,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
@@ -117,7 +110,7 @@ local function read_options(options, identifier, on_update)
local function parse_opts(full, options)
for key, val in pairs(full) do
- if not (string.find(key, prefix, 1, true) == nil) then
+ if string.find(key, prefix, 1, true) == 1 then
key = string.sub(key, string.len(prefix)+1)
-- match found values with defaults