diff options
-rw-r--r-- | lparser.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.82 2010/04/05 16:35:37 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.83 2010/04/17 12:46:32 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -74,9 +74,10 @@ static void error_expected (LexState *ls, int token) { | |||
74 | 74 | ||
75 | static void errorlimit (FuncState *fs, int limit, const char *what) { | 75 | static void errorlimit (FuncState *fs, int limit, const char *what) { |
76 | const char *msg; | 76 | const char *msg; |
77 | const char *where = (fs->f->linedefined == 0) ? | 77 | int line = fs->f->linedefined; |
78 | "main function" : | 78 | const char *where = (line == 0) |
79 | luaO_pushfstring(fs->L, "function at line %d", fs->f->linedefined); | 79 | ? "main function" |
80 | : luaO_pushfstring(fs->L, "function at line %d", line); | ||
80 | msg = luaO_pushfstring(fs->L, "too many %s (limit is %d) in %s", | 81 | msg = luaO_pushfstring(fs->L, "too many %s (limit is %d) in %s", |
81 | what, limit, where); | 82 | what, limit, where); |
82 | luaX_syntaxerror(fs->ls, msg); | 83 | luaX_syntaxerror(fs->ls, msg); |