Optional 'init' argument to 'string.gmatch'

The function 'string.gmatch' now has an optional 'init' argument,
similar to 'string.find' and 'string.match'. Moreover, there was
some reorganization in the manipulation of indices in the string
library.
This commit also includes small janitorial work in the manual
and in comments in the interpreter loop.
This commit is contained in:
Roberto Ierusalimschy
2019-01-08 14:22:32 -02:00
parent 4ace93ca65
commit 264659bd53
6 changed files with 116 additions and 52 deletions

View File

@@ -94,6 +94,11 @@ assert(string.char(string.byte("\xe4l\0
assert(string.char(string.byte("\xe4l\0<EFBFBD>u", 1, 0)) == "")
assert(string.char(string.byte("\xe4l\0<EFBFBD>u", -10, 100)) == "\xe4l\0<EFBFBD>u")
checkerror("out of range", string.char, 256)
checkerror("out of range", string.char, -1)
checkerror("out of range", string.char, math.maxinteger)
checkerror("out of range", string.char, math.mininteger)
assert(string.upper("ab\0c") == "AB\0C")
assert(string.lower("\0ABCc%$") == "\0abcc%$")
assert(string.rep('teste', 0) == '')