#[] means 'at'
For example,
phrases[1] will get your phrase AT the position one
local phrases = {"Hello!","How are you?","I love ROBLOX!"}
orint(phrases[1])
You could also say the following if you have a dictionary:
We're getting the game.Players AT royaltoe the index royaltoe
and myDictonary at the index dog
print(game.Players["royaltoe"]
myDictonary = {door = workspace.Door, dog = workspace.Dog}
print(myDictonary ["dog"])
#{} Wraps the contents of your table
Not much special about this, it just specifies where you want the table to start and to end.
myTable = { "bob", "apple", 2, game.Workspace.Part }
You can make a table inside a table like so:
myTable = { innerTable = {} }
print(myTable.innerTable)
or if you don't want to name the table you can do this:
local x = {}
local metaTable = {}
setmetatable(x, metaTable)
print(getmetatable(x))
metaTable = { {} }
#() Wraps the parameters of your function / specifies a function and it's parameters
Writing the function:
foo = 2
function foo(parameter1, parameter2)
print(parameter1, parameter2)
end
Since the variable foo and the function foo have the same name, how are we supposed to tell them apart?
We can do that with () to tell the script that we're calling a function.
Since foo has parameters we need to make sure we're sending the parameters inside ()
foo = 2
foo(1,2)
4 comments
I forgot to mention something about {}, you can specify a metatable (table inside a table) with the brackets. I'll show you how in a second when I make my edit.
edited
Ah you beat me to it
no worries you did a good job at explaining