|
| 08 May 2012 09:24 PM |
I've seen some people say things like this
script.Parent.Anchored = false
And some say it like this
script.Parent.Anchored=false
Does it matter/whats it do?
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:27 PM |
That's called whitespace. Lua ignores whitespace, so both are equivalent. The use of whitespace only helps in increasing the legibility of the code. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:28 PM |
"legibility"
I do not understand.
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
brad9873
|
  |
| Joined: 26 Jul 2009 |
| Total Posts: 3208 |
|
|
| 08 May 2012 09:28 PM |
| Easier to read if you space it out. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:29 PM |
So it dosnt matter?
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
brad9873
|
  |
| Joined: 26 Jul 2009 |
| Total Posts: 3208 |
|
|
| 08 May 2012 09:30 PM |
| No. Lua ignores the spaces. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:34 PM |
Another question.
If Lua ignores them how can I say this.
Workspace.Part 50.Anchored = false
Without having to name it Part50.
Also would Lua ignore Part_50
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:38 PM |
In order to index something with whitespace in its name, you have to use a different method of indexing.
game.Workspace["Part 50"].Anchored = true
Notice there is no . before the [, but there is a . after the ]. And the name of the object is a string. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:43 PM |
Would Lua notice Part_50?
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:44 PM |
| Part_50 is NOT the same as Part 50. The underscore is a valid character. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:46 PM |
What I mean is, If I name it Part_50 would that work in the script as
Workspace.Part_50.Anchored = false
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:47 PM |
Yes. But you can also use:
Workspace["Part_50"].Anchored = false
Both work. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:50 PM |
I'd rather not have text I dont need.
If (Not the scripting kind of if xD)
Workspace.Part_50.Anchored = false
will work, I see no point in making it
Workspace["Part_50"].Anchored = false
But thank you. And if there is a point to it, Please point it out to me
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:52 PM |
Workspace.Part_50.Anchored = false
That IS
Workspace["Part_50"].Anchored = false
They are EXACTLY the same. That's just good knowledge to have. ;P |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:53 PM |
I understand that, My question is, Why add the ["Part_50"] if Part_50 would work?
~!~ Plus One Post ~!~ |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 08 May 2012 09:54 PM |
LuaNoob, LOTS OF PEOPLE TOLD ME THIS(including AFF.)
Like I told you for the third time, try to make everysingle thing you name reasonable.
Say you made a house, and you call the name dinkle. That's not a good reasonable name, and you can get confused in the names and that's how your script could error.
So to answer your question, you should use [""] because it's reasonable. |
|
|
| Report Abuse |
|
|
|
| 08 May 2012 09:55 PM |
No need. Just understand they are the same. Add it to look fanceh.
Workspace["Part_50"]["Anchored"] = false
^ FANCEH |
|
|
| Report Abuse |
|
|