[vlc-commits] luarc: simplify
Pierre Ynard
git at videolan.org
Tue Mar 15 21:34:08 CET 2011
vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Mar 15 21:34:07 2011 +0100| [024d9ccdfd7a1b3c7f8ce36cc6f3b51f6282204b] | committer: Pierre Ynard
luarc: simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=024d9ccdfd7a1b3c7f8ce36cc6f3b51f6282204b
---
share/lua/intf/rc.lua | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index f660dd5..26f129e 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -600,8 +600,7 @@ function call_command(cmd,client,arg)
ok, msg = pcall( commands[cmd].func, cmd, client )
end
if not ok then
- local a = arg or ""
- if a ~= "" then a = " " .. a end
+ local a = arg and " "..arg or ""
client:append("Error in `"..cmd..a.."' ".. msg)
end
end
@@ -623,10 +622,8 @@ function call_object_command(cmd,client,arg)
end
local ok, vlcmsg, vlcerr = pcall( vlc.var.command, cmd, var, val )
if not ok then
- local v = var or ""
- if v ~= "" then v = " " .. v end
- local v2 = val or ""
- if v2 ~= "" then v2 = " " .. v2 end
+ local v = var and " "..var or ""
+ local v2 = val and " "..val or ""
client:append("Error in `"..cmd..v..v2.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message
end
if vlcmsg ~= "" then
More information about the vlc-commits
mailing list