diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-05 20:36:52 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-05 20:36:52 -0200 |
commit | d070506a255cc7cc33842a7bb97e1405cfb048aa (patch) | |
tree | b6230d87e080a17d675ecb88586eb6a6f1e7404a /lbaselib.c | |
parent | 0a87d9d3346bcf74d84e4d6bae775bceecef096f (diff) | |
download | lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.gz lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.bz2 lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.zip |
new function luaL_errstr
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -213,9 +213,6 @@ static int luaB_next (lua_State *L) { | |||
213 | 213 | ||
214 | 214 | ||
215 | static int passresults (lua_State *L, int status, int oldtop) { | 215 | static int passresults (lua_State *L, int status, int oldtop) { |
216 | static const char *const errornames[] = | ||
217 | {"ok", "run-time error", "file error", "syntax error", | ||
218 | "memory error", "error in error handling"}; | ||
219 | if (status == 0) { | 216 | if (status == 0) { |
220 | int nresults = lua_gettop(L) - oldtop; | 217 | int nresults = lua_gettop(L) - oldtop; |
221 | if (nresults > 0) | 218 | if (nresults > 0) |
@@ -227,7 +224,7 @@ static int passresults (lua_State *L, int status, int oldtop) { | |||
227 | } | 224 | } |
228 | else { /* error */ | 225 | else { /* error */ |
229 | lua_pushnil(L); | 226 | lua_pushnil(L); |
230 | lua_pushstring(L, errornames[status]); /* error code */ | 227 | lua_pushstring(L, luaL_errstr(status)); /* error code */ |
231 | return 2; | 228 | return 2; |
232 | } | 229 | } |
233 | } | 230 | } |
@@ -415,7 +412,8 @@ static int luaB_tostring (lua_State *L) { | |||
415 | 412 | ||
416 | static int luaB_resume (lua_State *L) { | 413 | static int luaB_resume (lua_State *L) { |
417 | lua_State *co = (lua_State *)lua_touserdata(L, lua_upvalueindex(1)); | 414 | lua_State *co = (lua_State *)lua_touserdata(L, lua_upvalueindex(1)); |
418 | lua_resume(L, co); | 415 | if (lua_resume(L, co) != 0) |
416 | lua_error(L, "error running co-routine"); | ||
419 | return lua_gettop(L); | 417 | return lua_gettop(L); |
420 | } | 418 | } |
421 | 419 | ||