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

How would I add a multidimensional table using a script using table.insert()?

This is not what I want:

Table = {Joe, Fred, Harry}

This is what I want:

Dimension = {{Joe, 1},{Fred, 2},{Harry, 8}}

(Im not doing the real script because I want this to be easy to understand for others :D) How would I do this using a script; For instance - this is creating the normal table:

MyTable = {}
table.insert(MyTable,"Joe")
table.insert(MyTable,"Fred")
table.insert(MyTable,"Harry")

But, I want to make it using table.insert(), because I am making an automatic table maker

1 answer

Your example would work.

Dimension = {{"Joe", 1},{"Fred", 2},{"Harry", 8}}

If I wanted to print "Joe" then I could simply do

print(Dimension[1][1])

3 comments

0

Yes, I know, but I want to use table.insert, to optimize

0

do table.insert(Dimension[1], "something")

0

or whichever table you're trying to access (for example, Dimension[1], Dimension[2], etc.)

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