|
| 05 Jun 2014 09:33 AM |
Hi.
I've seen the square brackets [] with some text in them in some scripts, and I can't find anything on the wiki about them.
So I just wanna know what they're for?
Thanks. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:41 AM |
They are often used to define a variable..
For example, one of my scripts use
for i, q in pairs(v[script.Parent.Parent.MannequinChoice.Value][" "]:GetChildren()) do
Square brackets are also used if there is a space in a model or parts name.
If a parts name was "Part 1", you couldn't do: workspace.Part 1.Transparency = 1
You would need to type workspace["Part 1"].Transparency = 1 |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:42 AM |
I already knew that, but thanks for trying.
It's something like, in the midi player gamehero made, he uses [Enter midi data here] thing.. .3.? |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:45 AM |
"I already knew that, but thanks for trying"
"trying"
How was he "trying" by asnwering your question? Just because someone uses them in a string for starter text, doesn't mean he defined it wrong. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:49 AM |
| Accomplish, I'm not trying to start a flame war, so don't try either. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:52 AM |
| Lol, sorry. So is it just used for text? Like ""? |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 09:59 AM |
Ugh, I'm still half asleep ;-;
Forget this post, I figured it out. |
|
|
| Report Abuse |
|
|
ajmhm1111
|
  |
| Joined: 22 Jun 2013 |
| Total Posts: 164 |
|
|
| 05 Jun 2014 10:02 AM |
Hello,
I only know 2 ways for []
The first is for accessing a value in a table.
local tab = {1,2,3}
print(tab[2]); --> 2
You can also use it for accessing Instances where their name has a space in it.
For example
Instance.new("Part",Workspace).Name = "This is a part" print(Workspace["This is a part"].Name) -->This is a part
Hope this helps --ajmhm1111 |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
|
| 05 Jun 2014 10:04 AM |
The first is for accessing a value in a table. You can also use it for accessing Instances where their name has a space in it.
They are both the same thing. Every instance is a table. |
|
|
| Report Abuse |
|
|
ajmhm1111
|
  |
| Joined: 22 Jun 2013 |
| Total Posts: 164 |
|
|
| 05 Jun 2014 10:09 AM |
Don't blind me with knowledge :)
--ajmhm1111 |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 10:12 AM |
| Sorry, it's not like this [] it's actually like this [[]] and it makes the text that you put in the middle purple. ;3 |
|
|
| Report Abuse |
|
|