(Solved) Fixing the cli.lua help option to build with Lua 5.3

*nix specific usage questions
nokangaroo
Blank Cone
Blank Cone
Posts: 29
Joined: 30 Dec 2010 17:11

(Solved) Fixing the cli.lua help option to build with Lua 5.3

Postby nokangaroo » 28 May 2015 20:06

Since my bug reports keep getting killed, I have to fix this myself:

Code: Select all

diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua index e2fa856..d6d3001 100644 --- a/share/lua/intf/cli.lua +++ b/share/lua/intf/cli.lua @@ -343,7 +343,7 @@ function help(name,client,arg) end if val.args then str = str .. " " .. val.args end if #str%2 == 1 then str = str .. " " end - str = str .. string.rep(" .",(width-(#str+#val.help)-1)/2) + str = str .. string.rep(" .",math.floor((width-(#str+#val.help)-1)/2)) str = str .. string.rep(" ",width-#str-#val.help) .. val.help end client:append(str)

This is for vlc-3.0 and vlc-2.2.



I believe that

a) math.floor will get VERY popular in Lua 5.3

b) cli.lua almost certainly has other bugs (that I won't find because I don't use it)

and c) DEVELOPERS: It's time to replace cli.lua with something less crappy and
obfuscated and more maintainable. Also, the cleanest solution would be to just
represent all times as integer microseconds insted of this timid

Code: Select all

client:append(math.floor(vlc.var.get( input, var ) / 1000000))
and

Code: Select all

vlc.var.set(input,"time",vlc.var.get(input,"time") + (posTime * 1000000))
To be honest, cli.lua looks like a prank to me, with its strip() and skip() and
skip2() and other levels of indirection. The kind of thing a capable programmer
might write as a practical joke.

Besides, interface scripts for local control through the commandline or a fifo
don't even need the host module.

vlc.net.write(1,"blabla") writes to stdout and vlc.net.read(0,<length>) reads
from stdin.

vlc.net.write(1) can be replaced by something like this:

Code: Select all

var = "testing" value = 123.456 var1 = string.format("%s %s=%f","echo",var,value) os.execute(var1)
which should also work in Windows if you replace echo with its Windows
equivalent (I assume there is one).

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: (Solved) Fixing the cli.lua help option to build with Lua 5.3

Postby Jean-Baptiste Kempf » 16 Jul 2015 12:37

a) we need to maintain 5.1 compatibility.
b) so, why report them, if you don't know where it is?
c) patches welcome, as always. But as you seem to suggest os.execute, I'm not sure you know what you are speaking about.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 7 guests