generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Whats The Difference?

Previous Thread :: Next Thread 
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
08 May 2012 09:28 PM
"legibility"

I do not understand.

~!~ Plus One Post ~!~
Report Abuse
brad9873 is not online. brad9873
Joined: 26 Jul 2009
Total Posts: 3208
08 May 2012 09:28 PM
Easier to read if you space it out.
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
08 May 2012 09:29 PM
So it dosnt matter?

~!~ Plus One Post ~!~
Report Abuse
brad9873 is not online. brad9873
Joined: 26 Jul 2009
Total Posts: 3208
08 May 2012 09:30 PM
No. Lua ignores the spaces.
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
08 May 2012 09:43 PM
Would Lua notice Part_50?

~!~ Plus One Post ~!~
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 May 2012 09:44 PM
Part_50 is NOT the same as Part 50. The underscore is a valid character.
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 May 2012 09:47 PM
Yes.
But you can also use:


Workspace["Part_50"].Anchored = false


Both work.
Report Abuse
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
TheLuaNoob is not online. TheLuaNoob
Joined: 04 May 2012
Total Posts: 482
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 is not online. 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
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image