aboutsummaryrefslogtreecommitdiff
path: root/lbaselib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-02-05 20:36:52 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-02-05 20:36:52 -0200
commitd070506a255cc7cc33842a7bb97e1405cfb048aa (patch)
treeb6230d87e080a17d675ecb88586eb6a6f1e7404a /lbaselib.c
parent0a87d9d3346bcf74d84e4d6bae775bceecef096f (diff)
downloadlua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.gz
lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.tar.bz2
lua-d070506a255cc7cc33842a7bb97e1405cfb048aa.zip
new function luaL_errstr
Diffstat (limited to 'lbaselib.c')
-rw-r--r--lbaselib.c8
1 files changed, 3 insertions, 5 deletions
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) {
213 213
214 214
215static int passresults (lua_State *L, int status, int oldtop) { 215static 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
416static int luaB_resume (lua_State *L) { 413static 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