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

How Can I Find Items In A Variable Like This?

I Don't Know How To Get Strings Out Of A Variable Like This

local names = {"a","b","c","d"}

thank you :)

1 answer

Those are called Tables, you can get values from them by indexing them, in your case you would do this

local names = {"a","b","c","d"}

names[1] -- a
names[2] -- b
names[4] -- d
names[5] -- nil

There is also a different type of values with keys instead of numbers, these types of tables look somehow like this

local SomeTable = {
	['cat'] = 'something',
	['john'] = 500,
	'a',
	'b',
	['c'] = Instance.new('Part'),
	[Enum.NormalId.Top] = true,
}

SomeTable['cat'] -- something
SomeTable[Enum.NormaId.Top] -- true
SomeTable[2] -- b

You see values without index (In your case a, b, c and d, all of them) must be indexed with number which is called Index and refers to location of the element in the table.

Tables Tables Tables Tables

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