diff options
-rw-r--r-- | lstrlib.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.140 2008/04/14 15:54:59 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.141 2008/06/12 14:21:18 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -600,8 +600,12 @@ static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, | |||
600 | luaL_addchar(b, news[i]); | 600 | luaL_addchar(b, news[i]); |
601 | else { | 601 | else { |
602 | i++; /* skip ESC */ | 602 | i++; /* skip ESC */ |
603 | if (!isdigit(uchar(news[i]))) | 603 | if (!isdigit(uchar(news[i]))) { |
604 | if (news[i] != L_ESC) | ||
605 | luaL_error(ms->L, "invalid use of " LUA_QL("%c") | ||
606 | " in replacement string", L_ESC); | ||
604 | luaL_addchar(b, news[i]); | 607 | luaL_addchar(b, news[i]); |
608 | } | ||
605 | else if (news[i] == '0') | 609 | else if (news[i] == '0') |
606 | luaL_addlstring(b, s, e - s); | 610 | luaL_addlstring(b, s, e - s); |
607 | else { | 611 | else { |