|
| 09 Mar 2015 10:25 PM |
put parentheses around pretty much everything
if (5 < 3) then print("banana"); end
local x = (true);
in tables
in dictionaries
in functions
use semicolons
because sometime in the future the semicolon god is going to take over
and require semicolons EVERYWHERE;;;;
so get a headstart
you do it:
after defining variables
local x = (true);
after a table or dictionary
local table = {(value1), (value2), (value3)};
local array = [(1), (7), (15)];
and lots of other places! post a script if you need to know where all the semicolons go |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Mar 2015 10:29 PM |
i seriously think it is good practice to use parentheses to make code safer
because some languages require it all the time
and i think it makes sense
if(condition) then (do stuff but do it carefully in parentheses at least partially); end |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2015 10:45 PM |
i do some of this stuff already. except the parentheses around EVERYTHING:
i only use them in these case
local a = (not b);
while (a) do end
and
if (a) then end
i don't remember off the top of my head where i use the thingies. |
|
|
| Report Abuse |
|
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 09 Mar 2015 10:47 PM |
| What makes this more "careful"? Do you mean that if there were no parenthesis the game would simply crash? I am confused... |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2015 10:48 PM |
| He's strongly hinting (not subtly at all) that he will one day take over Roblox an enforce parentheses and semicolons upon all of us. |
|
|
| Report Abuse |
|
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 09 Mar 2015 10:59 PM |
| Oh. Sounds like a comma-tastraphe. Could send us to the colon-ial times. I'm too shocked to be in exclamation. He could take over by the end of first period. Have I gone too far yet? I know many of you are prone to hyphen-ventilation. |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2015 11:02 PM |
| im only semi-worried about this; it shouldn't be too much of an exclamation. |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 09 Mar 2015 11:03 PM |
| semicolons also go after functions |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2015 11:08 PM |
not in lua link
but yes in other languages they do
but there is something called implied syntax, and if there isn't, i just invented it
you take the purpose of a bit of syntax, and understand it's conventions, and then figure out the most logical implementation into another area of knowledge |
|
|
| Report Abuse |
|
|
xLink123
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 11158 |
|
|
| 09 Mar 2015 11:09 PM |
| yea I thought that was implied when I wrote that |
|
|
| Report Abuse |
|
|
|
| 09 Mar 2015 11:10 PM |
| Well each language has it's own syntax implications. Lua will implicitly convert strings to numbers when you do math on them. C# will not. |
|
|
| Report Abuse |
|
|