|
On Thu, Sep 28, 2006 at 05:56:03PM -0700, Wesley Smith wrote:
> 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 > print(#array)> > 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.
for i = 1, #array do array[i]=nil end of course, array = {} is probably the cleaner way to go. William C. Bubel