From d070506a255cc7cc33842a7bb97e1405cfb048aa Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 5 Feb 2002 20:36:52 -0200 Subject: new function luaL_errstr --- lbaselib.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index 1b1d4d96..74d176dd 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -213,9 +213,6 @@ 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", "error in error handling"}; if (status == 0) { int nresults = lua_gettop(L) - oldtop; if (nresults > 0) @@ -227,7 +224,7 @@ static int passresults (lua_State *L, int status, int oldtop) { } else { /* error */ lua_pushnil(L); - lua_pushstring(L, errornames[status]); /* error code */ + lua_pushstring(L, luaL_errstr(status)); /* error code */ return 2; } } @@ -415,7 +412,8 @@ static int luaB_tostring (lua_State *L) { static int luaB_resume (lua_State *L) { lua_State *co = (lua_State *)lua_touserdata(L, lua_upvalueindex(1)); - lua_resume(L, co); + if (lua_resume(L, co) != 0) + lua_error(L, "error running co-routine"); return lua_gettop(L); } -- cgit v1.2.3-55-g6feb