[vlc-devel] [PATCH] lua/intf/cli: fix invalid concatenation of empty string

Filip Roséen filip at atch.se
Wed Oct 26 15:22:13 CEST 2016


Hi Pierre,

On 2016-10-26 15:17, Pierre Ynard wrote:

> > -            local str = "| "..prefix..tostring(item.id).." - "..item.name
> > +            local str = "| "..prefix..tostring(item.id)..
> > +                            (item.name == nil and "" or " - "..item.name)
> 
> In lua, only nil and false evaluate to false in boolean context, so I
> think the "== nil" is redundant.

 Indeed, but I reasoned that including the `== nil` was making the
 code easier to comprehend.
 
> Also, I don't find this very helpful as you end up with a blank entry,
> that possibly won't play correctly, with no obvious way to query info
> about it. Perhaps it would be more helpful to display something else
> instead if the name is missing.

The entry still has the numeric identifier, which is unconditionally
displayed, so you would still be able to query information about the
entity (in case that is wanted).

I do not understand what you mean by *"that possibly won't play
correctly"*, the "name" property of an item is not mandatory - and
will not aid when an item is actually scheduled to be played.

 - could you please elaborate that point?

 Best Regards,\
 Filip

> -- 
> Pierre Ynard
> "Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161026/45b386f6/attachment.html>


More information about the vlc-devel mailing list