lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sorry for the top post. 

Often when I think I'm being clever in code I put extra comments around it because the likelihood of a difficult bug will be particularly high in that area. ‎Perhaps these areas in my code require more comments. Or better yet, more linefeeds. :-/
‎
But ‎I found an example in code last night that I think works. I had to check all three variables in a function for type. One line if-then-else's were very effective for reducing the lines and creating a block of code that I can recognize without having to read. 

As I said, I think the problem dictates the style. I also think my Lua code is very clever. XD

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
‎
  Original Message  
From: Roberto Ierusalimschy
Sent: Wednesday, June 7, 2017 5:32 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: Lua Style Guide ?

> [...] One of my
> current favorites in Lua is if/then/else on one line, which will
> rarely fit in 80 characters:
> 
> if table.value == "another value" then number1 = number1 + 6 else
> number1 = 0 end

That explains a lot :-)

-- Roberto