Jump to content




Infinite table


  • You cannot reply to this topic
2 replies to this topic

#1 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

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

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

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.

#3 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 10 March 2013 - 10:32 AM

View PostKingdaro, on 10 March 2013 - 10:25 AM, said:

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





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users