error message

This commit is contained in:
Roberto Ierusalimschy 2006-10-24 10:31:48 -03:00
parent fc875334fd
commit 9f5a052c27
1 changed files with 7 additions and 5 deletions

View File

@ -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);
}