This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Engineer's profile picture

Infinite table

Started by Engineer, 10 March 2013 - 09:22 AM
Engineer #1
Posted 10 March 2013 - 10:22 AM
Hello,

For my program I am writing I need basicly an infinite table. Is there a way to add [3] to this table:

local tTable = {
[1] = {"x", "z"},
[2] = {"a", "b"}
}

This are just some random chars, this is my full test code:
http://pastebin.com/ivNB9tuT

Seems to be working fine except for the last bit. ( -> the table.insert and the print both wont work either )

I hope this is even possible in a way and as always, thank you guys in advance,

Engineer
Kingdaro #2
Posted 10 March 2013 - 10:25 AM

tTable[#tTable + 1] = {'foo', 'bar'}

or


table.insert(tTable, {'foo', 'bar'})

Also, "tTable" is a horrible variable name. In your case, you should use something like "tPrograms" instead.
Engineer #3
Posted 10 March 2013 - 10:32 AM

tTable[#tTable + 1] = {'foo', 'bar'}

or


table.insert(tTable, {'foo', 'bar'})

Also, "tTable" is a horrible variable name. In your case, you should use something like "tPrograms" instead.
Thanks a lot, thats exactly what Im looking for.
I know tTable is a horrible name, I tend to use weird names when testing, I couldnt use table because that would override something and that means trouble. So tTable it is :P/>