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

Can you store tables in side of a table?

I want to make a head tag script, so in a table named tags I want to store more than one table, each table stores 2 strings player name and what the tag should say, a color3 value of the tag color

local tags ={
	{
		"","",Color3.fromRGB()
	}
	{
		"","",Color3.fromRGB()
	}
}

Is this possible?

3 comments

1

yes

0

how

1

when listing things in a table you need to include a separator ,

1 answer

✓ Accepted answer

This is a clear yes. Lua structures everything to be quite flexible. You can store arrays in a table. Or vice versa that you can store tables in arrays. An example is.

local tableinArray = {
	{Key="Value here!"};
	{Key="Value 2!"};
}
print(tableinArray[2].Key) --> "Value 2!"
print(tableinArray[1].key) --> "Value here!";

local arrayInTable = {
	IndexKey = {5,"Hello"};
	OtherKey = {1,5,1};
]
print(arrayInTable.IndexKey[1]) --> 5
print(arrayInTable.IndexKey[2]) --> "Hello"
print(arrayInTable["OtherKey"][3]) --> 1

Hope this helped.

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