BUG: option '%q' for string.format does not handle '\r' correctly

This commit is contained in:
Roberto Ierusalimschy
2006-04-12 17:13:52 -03:00
parent 672bb67ee6
commit 8487913697
2 changed files with 52 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.129 2005/12/21 12:59:43 roberto Exp roberto $
** $Id: lstrlib.c,v 1.130 2005/12/29 15:32:11 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -703,6 +703,10 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
luaL_addchar(b, *s);
break;
}
case '\r': {
luaL_addlstring(b, "\\r", 2);
break;
}
case '\0': {
luaL_addlstring(b, "\\000", 4);
break;