summaryrefslogtreecommitdiff
path: root/iolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'iolib.c')
-rw-r--r--iolib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/iolib.c b/iolib.c
index fb2c3b4b..bb352009 100644
--- a/iolib.c
+++ b/iolib.c
@@ -115,8 +115,14 @@ static void io_read (void)
115 int c = NEED_OTHER; 115 int c = NEED_OTHER;
116 luaI_addchar(0); 116 luaI_addchar(0);
117 while (*p) { 117 while (*p) {
118 if (*p == '{' || *p == '}') { 118 if (*p == '{') {
119 inskip = (*p == '{'); 119 inskip++;
120 p++;
121 }
122 else if (*p == '}') {
123 if (inskip == 0)
124 lua_error("unbalanced `{...}' in read pattern");
125 inskip--;
120 p++; 126 p++;
121 } 127 }
122 else { 128 else {
@@ -125,7 +131,7 @@ static void io_read (void)
125 if (c == NEED_OTHER) c = getc(lua_infile); 131 if (c == NEED_OTHER) c = getc(lua_infile);
126 m = (c == EOF) ? 0 : singlematch((char)c, p); 132 m = (c == EOF) ? 0 : singlematch((char)c, p);
127 if (m) { 133 if (m) {
128 if (!inskip) luaI_addchar(c); 134 if (inskip == 0) luaI_addchar(c);
129 c = NEED_OTHER; 135 c = NEED_OTHER;
130 } 136 }
131 switch (*ep) { 137 switch (*ep) {