Search found 2 matches

by HabitualVitality
Fri Oct 23, 2020 11:18 am
Forum: Support and Development
Topic: for loop to delete single entity just deletes everything in the table instead
Replies: 2
Views: 3548

Re: for loop to delete single entity just deletes everything in the table instead

Without digging deeper into your code, presumably "cube[ i ]" doesn't point to any value at all, number or otherwise. When you call table.remove without a second argument (either passing nil or nothing at all), it will just remove the last entry from the table, and as such you get a situa...
by HabitualVitality
Fri Oct 23, 2020 7:00 am
Forum: Support and Development
Topic: for loop to delete single entity just deletes everything in the table instead
Replies: 2
Views: 3548

for loop to delete single entity just deletes everything in the table instead

The purpose of this for loop is to check when one of the entities (they're just squares that spawn on the left/right and then move to the other side) has fulfilled it's purpose of making it to the opposite side they spawned, and if so; delete them. --make loop go backwards so it doesn't error when o...