mirror of https://github.com/rusefi/lua.git
error codes as strings for dofile and dostring
This commit is contained in:
parent
d1c351857d
commit
5d69960734
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: $
|
||||
** $Id: lbaselib.c,v 1.1 2000/09/05 19:33:56 roberto Exp roberto $
|
||||
** Basic library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -217,6 +217,8 @@ static int luaB_next (lua_State *L) {
|
|||
|
||||
|
||||
static int passresults (lua_State *L, int status, int oldtop) {
|
||||
static const char *const errornames[] =
|
||||
{"OK", "RUN-TIME ERROR", "FILE ERROR", "SYNTAX ERROR", "MEMORY ERROR"};
|
||||
if (status == 0) {
|
||||
int nresults = lua_gettop(L) - oldtop;
|
||||
if (nresults > 0)
|
||||
|
@ -228,7 +230,7 @@ static int passresults (lua_State *L, int status, int oldtop) {
|
|||
}
|
||||
else { /* error */
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, status); /* error code */
|
||||
lua_pushstring(L, errornames[status]); /* error code */
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue