2tallhankJoin Date: 2010-06-11 Post Count: 2075 |
[ Content Deleted ] |
|
2tallhankJoin Date: 2010-06-11 Post Count: 2075 |
[ Content Deleted ] |
|
RiderjJoin Date: 2011-08-15 Post Count: 1534 |
No, but it is convention to use tables when entering a new scope.
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
RiderjJoin Date: 2011-08-15 Post Count: 1534 |
tabs*
Wow what possessed me to say tables :O
[[ 7/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
2tallhankJoin Date: 2010-06-11 Post Count: 2075 |
[ Content Deleted ] |
|
NavydevJoin Date: 2012-02-21 Post Count: 274 |
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. |
|
|
You don't have to but it makes it easier to read and look neater. Think of it as scripting etiquette. |
|
|
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 |
|
|
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 |
|
2tallhankJoin Date: 2010-06-11 Post Count: 2075 |
[ Content Deleted ] |
|
|
Y U NO TAB IN ON if's not prints()'s. |
|
2tallhankJoin Date: 2010-06-11 Post Count: 2075 |
[ Content Deleted ] |
|
stravantForum ModeratorJoin Date: 2007-10-22 Post Count: 2893 |
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. |
|
|
stravant has won this post again. |
|
|
@stravant; Didn't know you could change tab space in settings. So changing that. Why do you start foruming now and not on xLEGOx? |
|
|
xLEGOx's profile was swapped with Stravant's. |
|
|
@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. |
|
|
What I find funny is that he was a forumer on xLEGOx. |
|
|
|
Yeah I knew that. I just never saw him on the forums when he was xLEGOx, and now I do when he's stravant. |
|