Re: Removing Specific Subtables?
Posted: Sat Nov 24, 2012 8:09 pm
You can't call a table (and doing this in Lua will cause you to receive an error). You're thinking of something different.
for i = #enemy - This is the initial statement of the for loop, declaring the initial value of i (#enemy means the total number of items in the enemy table). The 1 and -1 mean "Keep going through each value of the table with i being one less each time, until we get to 1."
See also: http://www.lua.org/pil/4.3.4.html
for i = #enemy - This is the initial statement of the for loop, declaring the initial value of i (#enemy means the total number of items in the enemy table). The 1 and -1 mean "Keep going through each value of the table with i being one less each time, until we get to 1."
See also: http://www.lua.org/pil/4.3.4.html
Yes. Your objects will have a remove variable, initially set to false. Set it to true when you want to remove the object. This is because you don't want to actually remove the objects while you're still processing their logic (as this would cause a lot of problems). Instead, after running their logic you run through the list to see which objects need to be removed, and then remove those.WolfNinja2 wrote:and enemy.remove is that just checking if v.remove is true?