Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What does it mean when there is variable[something]?

Hello, What does it mean when a variable is defined and in the next line the scripter says variable[something]? Thanks! I know it sounds basic, but I've seen it very often and believe it must be important.

2 comments

1

It means variable is a table.

1

Brackets index a table, so if you have t={'a','b','c','d','e'}, t[3] is 'c'

1 answer

Whenever you use brackets, you're grabbing something from a table.

In example

lottery = ['15','22','35','47','52']
print(lottery[2])
--If this example is correct, it will print out the second thing listed in the table, so in the case, it'll print the number 22.

This discussion is preserved as it was. New answers, comments, and votes are closed.