Commit 024d9ccd authored by Pierre Ynard's avatar Pierre Ynard

luarc: simplify

parent 727b2498
...@@ -600,8 +600,7 @@ function call_command(cmd,client,arg) ...@@ -600,8 +600,7 @@ function call_command(cmd,client,arg)
ok, msg = pcall( commands[cmd].func, cmd, client ) ok, msg = pcall( commands[cmd].func, cmd, client )
end end
if not ok then if not ok then
local a = arg or "" local a = arg and " "..arg or ""
if a ~= "" then a = " " .. a end
client:append("Error in `"..cmd..a.."' ".. msg) client:append("Error in `"..cmd..a.."' ".. msg)
end end
end end
...@@ -623,10 +622,8 @@ function call_object_command(cmd,client,arg) ...@@ -623,10 +622,8 @@ function call_object_command(cmd,client,arg)
end end
local ok, vlcmsg, vlcerr = pcall( vlc.var.command, cmd, var, val ) local ok, vlcmsg, vlcerr = pcall( vlc.var.command, cmd, var, val )
if not ok then if not ok then
local v = var or "" local v = var and " "..var or ""
if v ~= "" then v = " " .. v end local v2 = val and " "..val or ""
local v2 = val or ""
if v2 ~= "" then v2 = " " .. v2 end
client:append("Error in `"..cmd..v..v2.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message client:append("Error in `"..cmd..v..v2.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message
end end
if vlcmsg ~= "" then if vlcmsg ~= "" then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment