lua-users home
lua-l archive

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

> joao lobato wrote:
> >I suppose it would be better all around if string.sub only accepted
> >non-null integers as indices
> If s:sub(5,4) is valid then s:sub(1,0) should be valid too.

Sure. s:sub(1,n) is the prefix of 's' with length 'n', so zero must be
a valid index to allow the empty prefix. zero is not negative, so it
counts from the beginning.

-- Roberto