Fix string.gsub behaviour with negative n
This commit is contained in:
@@ -640,6 +640,8 @@ public class StringLib extends TwoArgFunction {
|
||||
int lastmatch = -1; /* end of last match */
|
||||
LuaValue repl = args.arg(3);
|
||||
int max_s = args.optint(4, srclen+1);
|
||||
if (max_s < 0)
|
||||
max_s = srclen+1;
|
||||
final boolean anchor = p.length() > 0 && p.charAt(0) == '^';
|
||||
|
||||
Buffer lbuf = new Buffer(srclen);
|
||||
|
||||
Reference in New Issue
Block a user