Better documentation for LUA_ERRERR
Not all errors in a message handler generate a LUA_ERRERR.
This commit is contained in:
4
ldo.c
4
ldo.c
@@ -203,7 +203,7 @@ TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
|
|||||||
#define ERRORSTACKSIZE (MAXSTACK + STACKERRSPACE)
|
#define ERRORSTACKSIZE (MAXSTACK + STACKERRSPACE)
|
||||||
|
|
||||||
|
|
||||||
/* raise an error while running the message handler */
|
/* raise a stack error while running the message handler */
|
||||||
l_noret luaD_errerr (lua_State *L) {
|
l_noret luaD_errerr (lua_State *L) {
|
||||||
TString *msg = luaS_newliteral(L, "error in error handling");
|
TString *msg = luaS_newliteral(L, "error in error handling");
|
||||||
setsvalue2s(L, L->top.p, msg);
|
setsvalue2s(L, L->top.p, msg);
|
||||||
@@ -339,7 +339,7 @@ int luaD_growstack (lua_State *L, int n, int raiseerror) {
|
|||||||
a stack error; cannot grow further than that. */
|
a stack error; cannot grow further than that. */
|
||||||
lua_assert(stacksize(L) == ERRORSTACKSIZE);
|
lua_assert(stacksize(L) == ERRORSTACKSIZE);
|
||||||
if (raiseerror)
|
if (raiseerror)
|
||||||
luaD_errerr(L); /* error inside message handler */
|
luaD_errerr(L); /* stack error inside message handler */
|
||||||
return 0; /* if not 'raiseerror', just signal it */
|
return 0; /* if not 'raiseerror', just signal it */
|
||||||
}
|
}
|
||||||
else if (n < MAXSTACK) { /* avoids arithmetic overflows */
|
else if (n < MAXSTACK) { /* avoids arithmetic overflows */
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ print(x) --> 10 (the global one)
|
|||||||
|
|
||||||
Notice that, in a declaration like @T{local x = x},
|
Notice that, in a declaration like @T{local x = x},
|
||||||
the new @id{x} being declared is not in scope yet,
|
the new @id{x} being declared is not in scope yet,
|
||||||
and so the @id{x} in the right-hand side refers to the outside variable.
|
and so the @id{x} on the right-hand side refers to the outside variable.
|
||||||
|
|
||||||
Because of the @x{lexical scoping} rules,
|
Because of the @x{lexical scoping} rules,
|
||||||
local variables can be freely accessed by functions
|
local variables can be freely accessed by functions
|
||||||
@@ -2826,7 +2826,16 @@ status codes to indicate different kinds of errors or other conditions:
|
|||||||
For such errors, Lua does not call the @x{message handler}.
|
For such errors, Lua does not call the @x{message handler}.
|
||||||
}
|
}
|
||||||
|
|
||||||
@item{@defid{LUA_ERRERR}| error while running the @x{message handler}.}
|
@item{@defid{LUA_ERRERR}|
|
||||||
|
stack overflow while running the @x{message handler}
|
||||||
|
due to another stack overflow.
|
||||||
|
More often than not,
|
||||||
|
this error is the result of some other error while running
|
||||||
|
a message handler.
|
||||||
|
An error in a message handler will call the handler again,
|
||||||
|
which will generate the error again, and so on,
|
||||||
|
until this loop exhausts the stack and cause this error.
|
||||||
|
}
|
||||||
|
|
||||||
@item{@defid{LUA_ERRSYNTAX}| syntax error during precompilation
|
@item{@defid{LUA_ERRSYNTAX}| syntax error during precompilation
|
||||||
or format error in a binary chunk.}
|
or format error in a binary chunk.}
|
||||||
|
|||||||
Reference in New Issue
Block a user