lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I'm trying to "clear" an array after a loop is run and reuse it again
on the next iteration.  By "clear" I mean that I wat #array to be 0.

So, if I have:

array = {}

--add stuff to array in loop
array[#array+1] = stuff

--end loop

--clear array
array[1] = nil

What I'm getting from the print statement is the length of the array
after the loop ended, not the expected 0.  Is this correct?  I don't
see why this wouldn't work.