lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 9f5a052c27a3182bb29250b99fd622cf9ae5f965
parent fc875334fdc2497e90969ceed1851004d9baf3c5
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 24 Oct 2006 10:31:25 -0300

error message

Diffstat:
Mlparser.c | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lparser.c b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.47 2006/09/14 12:59:06 roberto Exp roberto $ +** $Id: lparser.c,v 2.48 2006/09/14 18:42:28 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -69,10 +69,12 @@ static void error_expected (LexState *ls, int token) { static void errorlimit (FuncState *fs, int limit, const char *what) { - const char *msg = (fs->f->linedefined == 0) ? - luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : - luaO_pushfstring(fs->L, "function at line %d has more than %d %s", - fs->f->linedefined, limit, what); + const char *msg; + const char *where = (fs->f->linedefined == 0) ? + "main function" : + luaO_pushfstring(fs->L, "function at line %d", fs->f->linedefined); + msg = luaO_pushfstring(fs->L, "too many %s in %s (limit is %d)", + what, where, limit); luaX_lexerror(fs->ls, msg, fs->ls->t.token); }