2tallhank
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 2075 |
|
| |
|
2tallhank
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 2075 |
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 26 Feb 2012 09:05 PM |
No, but it is convention to use tables when entering a new scope.
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 26 Feb 2012 09:06 PM |
tabs*
Wow what possessed me to say tables :O
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
2tallhank
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 2075 |
|
| |
|
Navydev
|
  |
| Joined: 21 Feb 2012 |
| Total Posts: 274 |
|
|
| 26 Feb 2012 09:07 PM |
| You dont have to, but it makes it easier for you to read and for others as well. It also shows how functions are built up and were they are nested. Yes, you can have your code all on one line, which is useful for script building places, but not for scripts created in Studio. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 09:08 PM |
| You don't have to but it makes it easier to read and look neater. Think of it as scripting etiquette. |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 09:10 PM |
As a rule of thumb, you tab the lines of code after each item that requires and end. This is not required, but people like to do it for two main reasons:
1) It makes the code more readable. 2) So you don't forget the ends.
Here's an example:
local x = 1 function PrintItem() print(x) x = x + 1 if x == 5 then x = 1 end end |
|
|
| Report Abuse |
|
|
|
| 26 Feb 2012 09:10 PM |
And of course, it all collapses again -_-
local x = 1 function PrintItem() print(x) x = x + 1 if x == 5 then x = 1 end end |
|
|
| Report Abuse |
|
|
2tallhank
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 2075 |
|
| |
|
|
| 26 Feb 2012 09:58 PM |
| Y U NO TAB IN ON if's not prints()'s. |
|
|
| Report Abuse |
|
|
2tallhank
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 2075 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 26 Feb 2012 11:46 PM |
It's when you hit the key that says `tab` on your keyboard, it's sort of like a space but more powerful in what it can be used for. In general it's used to format blocks of related stuff. Back in the old days you would use tabs to help format your documents, but now they're mainly just used in code because programs like word will do that for you these days.
The advantage of using tabs over spaces is that each person can set how wide a space each tab represents to fit their liking (for instance in Roblox you can do this in the studio settings), without having to edit the actual code.
In the code the tabbing makes it much easier to see what code belongs to each if statement and function etc, and makes it immediately obvious when an end is missing from one of the blocks in the code. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2012 07:22 AM |
| stravant has won this post again. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2012 04:39 PM |
| @stravant; Didn't know you could change tab space in settings. So changing that. Why do you start foruming now and not on xLEGOx? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2012 05:25 PM |
| xLEGOx's profile was swapped with Stravant's. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2012 05:25 PM |
@epicfail22 Idk y he started forming, but he got a name chabge from xlegox to starvent, becasue he is now a moderator, and there couldnt be "lego" in his name. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2012 05:26 PM |
| What I find funny is that he was a forumer on xLEGOx. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Feb 2012 06:45 PM |
| Yeah I knew that. I just never saw him on the forums when he was xLEGOx, and now I do when he's stravant. |
|
|
| Report Abuse |
|
|