ROBOFROG
|
  |
| Joined: 04 Jan 2009 |
| Total Posts: 1519 |
|
|
| 05 Jul 2015 05:00 PM |
| In more detail, assume I had a table with 10 listings, and then deleted the third listing. If I were to make a new listing would it fill in the third or make an eleventh? |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 05:03 PM |
It depends on two things.
table.remove() will automatically shift all indexes down. table[pos] = nil will remove the index.
table.insert will however, insert at the very last place. ------------- local tab = {1, 2, 3, 4} tab[3] = nil table.insert(tab, 5) print(tab[5]) |
|
|
| Report Abuse |
|
|
ROBOFROG
|
  |
| Joined: 04 Jan 2009 |
| Total Posts: 1519 |
|
|
| 05 Jul 2015 05:03 PM |
| Or, would it make a tenth and the listings after 3 would move down 1? |
|
|
| Report Abuse |
|
|
ROBOFROG
|
  |
| Joined: 04 Jan 2009 |
| Total Posts: 1519 |
|
|
| 05 Jul 2015 05:03 PM |
| Oh, heh, posted right after my last comment was verified. I appreciate the help. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 05:04 PM |
table.remove() will do this: local tab = {1, 2, 3, 4} table.remove(tab, 3) table.insert(tab, 5) print(tab[4]) |
|
|
| Report Abuse |
|
|