[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Suggestion: return nil in string.find/match() for indexes that are before the string
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 2 Mar 2014 10:18:24 +0200
2014-03-02 9:06 GMT+02:00 Coroutines <email@example.com>:
> This does not:
>> = string.find('cat', 'cat', -31, true)
> 1 3
> I expect it to match the string at the index I passed to it, not
> silently reposition the start at a valid index (1).
All the string functions do that. It is documented under string.sub.
| If, after the translation of negative indices, i is less than 1, it
is corrected to 1.