Page 2 of 2

Re: killing a set of elements from a list...

Posted: Fri Aug 29, 2008 12:02 am
by surtic
t[#t+1] is the first empty spot
Nobody guarantees that. It could be the first, and it could be the last - it's simply undefined.

Code: Select all

Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> x = {1,2,3,4,5,6,7}
> x[3] = nil
> x[5] = nil
> =#x
7
> x[7] = nil
> =#x
2
>
That's why I don't like lists with gaps.