lua-users home
lua-l archive

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


2014-04-24 17:41 GMT+02:00 steve donovan <steve.j.donovan@gmail.com>:
> On Thu, Apr 24, 2014 at 5:34 PM, Thiago L. <fakedme@gmail.com> wrote:
>> I think it should expand +inf to #str and -inf to 1 (= passing -#str to the
>> function)...
>
> Actually, on 2nd thought, I agree with Lukas - I also would expect
> s:sub(inf) to be the empty string, seeing inf as the limit of
> increasing integer value.

Nothing special about inf here, actually.
Any large number will do the same.

> s='abc'
> print(s:sub(0))
abc
> print(s:sub(1e10))

> print(s:sub(1e100))
abc