|
| 04 Aug 2015 02:49 PM |
so i was looking in a script and i found this and i dont know what the brackets do
for i,v in pairs(script.Parent.Buttons:GetChildren())
local object = script.Parent.Purchases:FindFirstChild(v.Object.Value) if object ~= nil then objects[object.Name] = object:clone() object:Destroy()
and some lines down,
objects[v.Object.Value].Parent = script.Parent.PurchasedObjects
so im confused what the brackets do
<3 cats <3 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 04 Aug 2015 02:51 PM |
() = adding arguments to a function [] = table indexing {} = table defining
- This is the will of Steins;Gate |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2015 02:51 PM |
and what does that do exactly?
<3 cats <3 |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2015 02:51 PM |
If you want to get an object in Workspace but it has spaces, you can do this
Workspace["Spaced Object"]
Or if you want to combine a variable with text/another variable and find that in Workspace
Workspace[variable1.." / "..variable2]
You can also use double brackets to create a string
str = [[ ayooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ]] |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2015 02:53 PM |
table{'a','b','c'} print(table[2])
prints out 'b'
You can also index things using strings:
table{['Foo']='Yes',['Bar']='No'} print(table['Bar'])
Prints out 'No'
- This is the will of Steins;Gate |
|
|
| Report Abuse |
|
|
2JJ1
|
  |
| Joined: 15 Mar 2012 |
| Total Posts: 1571 |
|
|
| 04 Aug 2015 02:55 PM |
You know how regular variables store only 1 thing? var = "1 thing" print(var)
Tables store several var = {"here", " is", " several", " things"} for i = 1,4 do print(var[i]) end |
|
|
| Report Abuse |
|
|