Stumbled upon this on github, very informative page for any coder beginner or genius…good read!
There are quite a few things I disagree with in that post. I didn’t give it a complete read, but as with anything, it’s an opinion and if it works for you, then that is fine… Just to argue a couple of points.
First quotes should be doubles unless you need to have quotes in the string. You are more likely going to use an apostrophe inside a string than you are to use quotes around a phrase. Most programming languages use doubles instead of singles to contain strings. It’s what most people expect when reading code. However, singles work, and it probably ends up being a point of preference.
Multi-line strings. Lua supports the [[and]] operators for a reason. Saying that using this is bad, is in my opinion bad. They are there for a reason. Now for someone coming from another language, it’s confusing, but it is the Lua way.
I also don’t have issues doing this:
local someTable = {}
someTable.someVar = “someData”
It’s a style issue. I think for longer tables, doing it as above makes more sense. For short tables (like options to be passed in as parameters) the doing everything in side the {} method makes more sense.
But this is just my opinion.
There are quite a few things I disagree with in that post. I didn’t give it a complete read, but as with anything, it’s an opinion and if it works for you, then that is fine… Just to argue a couple of points.
First quotes should be doubles unless you need to have quotes in the string. You are more likely going to use an apostrophe inside a string than you are to use quotes around a phrase. Most programming languages use doubles instead of singles to contain strings. It’s what most people expect when reading code. However, singles work, and it probably ends up being a point of preference.
Multi-line strings. Lua supports the [[and]] operators for a reason. Saying that using this is bad, is in my opinion bad. They are there for a reason. Now for someone coming from another language, it’s confusing, but it is the Lua way.
I also don’t have issues doing this:
local someTable = {}
someTable.someVar = “someData”
It’s a style issue. I think for longer tables, doing it as above makes more sense. For short tables (like options to be passed in as parameters) the doing everything in side the {} method makes more sense.
But this is just my opinion.