|
| 05 Aug 2014 09:38 PM |
| Just curious, because I like Example[object] |
|
|
| Report Abuse |
|
|
| |
|
NetsFan0
|
  |
| Joined: 17 Apr 2009 |
| Total Posts: 2777 |
|
|
| 05 Aug 2014 09:42 PM |
I believe the second can only be used if say, you were looking for something named the same thing as a variable's name. For example if you have a variable named hello and you were looking for example's child named what hello was named uou would say Example[hello.Name] otherwise you use Example.object to find it.
ɪᴛ ᴀɪɴ'ᴛ ᴇᴀsʏ, ʙᴇɪɴɢ ᴀ ɴᴀᴅᴀʟ ʜᴀᴛᴇʀ |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 05 Aug 2014 09:43 PM |
They are the same, but I honestly don't know why you would bother doing this:
game["Workspace"]["Player1"]["Head"]["CFrame"] = CFrame.new()
When you could just: game.Workspace.Player1.Head.CFrame = CFrame.new()
Way shorter and less tedious to type. |
|
|
| Report Abuse |
|
|
NetsFan0
|
  |
| Joined: 17 Apr 2009 |
| Total Posts: 2777 |
|
|
| 05 Aug 2014 09:43 PM |
Or at least that's how I use them, I'm not sure if you CAN'T use them differently.
ɪᴛ ᴀɪɴ'ᴛ ᴇᴀsʏ, ʙᴇɪɴɢ ᴀ ɴᴀᴅᴀʟ ʜᴀᴛᴇʀ |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Aug 2014 11:45 AM |
| Well I use both ig just sometimes it's more fun to Example[object] because it looks better. :P |
|
|
| Report Abuse |
|
|
|
| 06 Aug 2014 11:49 AM |
Things like this;
game.Workspace.Part Test:destroy() dont work cuz the spacew ill break the script;
So the [""] is used for names with an space.
like; game.Workspace["Part Test"]:destroy() |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 06 Aug 2014 12:05 PM |
^ That's really the only reason it should be used. |
|
|
| Report Abuse |
|
|
| |
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 06 Aug 2014 01:27 PM |
Not any neater than:
player.Character char.Humanoid
Personally I think that looks better. |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 08:01 AM |
| sp["Name"] looks better than sp.Name |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 08:18 AM |
| I don't honestly care how neat a script is |
|
|
| Report Abuse |
|
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 07 Aug 2014 08:56 AM |
| Well, it's a matter of opinion. It might look better to you, but it actually looks worse to me. Even so, you you really think it's worth the extra time to type it? |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 09:01 AM |
Y'all need to google "syntactic sugar"
~The herp lerped a derp~ |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 03:23 PM |
| Yes. It doesn't matter how much I type, honestly. Whatever is the most defined and organized, I'm kinda OCD with my scripting. |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 07 Aug 2014 03:25 PM |
| Example[object] is technically more efficient due to the fact that it won't get confused with properties or variables that might be related to the object |
|
|
| Report Abuse |
|
|
| |
|
blockoo
|
  |
| Joined: 08 Nov 2007 |
| Total Posts: 17202 |
|
|
| 07 Aug 2014 03:27 PM |
@sbk Bracket notation will find properties as well:
game.Workspace.Part["Size"] = Vector3.new() |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Aug 2014 03:29 PM |
Good luck being consistent when using brackets.
local part = Game["Workspace"]["Model"]["Part"]; local touched = part["Touched"]; touched["connect"](touched, function(hit) local hitter = hit["GetFullName"]; print(hitter(hit)); end); |
|
|
| Report Abuse |
|
|
| |
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 07 Aug 2014 03:31 PM |
@blockoo
my bad I must have been confusing them for something else |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2014 03:40 PM |
I'm not talking about ONLY using them, I just mean more than I need to... not [s][d]... that just looks weird
|
|
|
| Report Abuse |
|
|