lua-users home
lua-l archive

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


> That is a good point, Roberto. However it is worth noting that in Lua 5.2.1,
> your example works because table.remove returns nothing when pos>t#, and
> leaves t alone. It seems an unnecessarily radical change to move pos==#t+1
> into the range that table.remove operates on. Can I suggest it would be
> safer to return nothing for pos==#t+1, and error for pos>#t+1? (or a case
> could be made for returning nothing for pos>#t, so only pos<1 would be an
> error).
> 
> My concern is that # (or more accurately luaL_len) uses any '__len'
> metamethod, so we really should not be depending on the assumption that
> t[#t+1]==nil (or that t[#t+2]==nil for that matter).

This seems a little nit-picking, does it not?

-- Roberto