diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-01 17:48:12 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-01 17:48:12 -0300 |
commit | 751cd867d3e0338279fa6f3390c8b7ddc0108659 (patch) | |
tree | 726f6f3cd49109382b2c0d7ee6a1e0fea740afbd /ltests.c | |
parent | b36b2a061c88be22e36900146cbcad39bab07f5d (diff) | |
download | lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.gz lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.bz2 lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.zip |
new way to handle errors
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.116 2002/04/05 18:54:31 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.117 2002/04/24 20:07:46 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -383,7 +383,11 @@ static int udataval (lua_State *L) { | |||
383 | 383 | ||
384 | static int doonnewstack (lua_State *L) { | 384 | static int doonnewstack (lua_State *L) { |
385 | lua_State *L1 = lua_newthread(L); | 385 | lua_State *L1 = lua_newthread(L); |
386 | int status = lua_dostring(L1, luaL_check_string(L, 1)); | 386 | size_t l; |
387 | const char *s = luaL_check_lstr(L, 1, &l); | ||
388 | int status = lua_loadbuffer(L1, s, l, s); | ||
389 | if (status == 0) | ||
390 | status = lua_pcall(L1, 0, 0, 0); | ||
387 | lua_pushnumber(L, status); | 391 | lua_pushnumber(L, status); |
388 | lua_closethread(L, L1); | 392 | lua_closethread(L, L1); |
389 | return 1; | 393 | return 1; |