diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-26 14:32:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-26 14:32:05 -0300 |
| commit | 9273fbd131eb0be7d4e7ca4f44345b41f8a557cf (patch) | |
| tree | 1503563eb840378013125b4892b7686ac8d8787e /lua.c | |
| parent | be666a662b79e12c300dbf6d74d0a6626acac06f (diff) | |
| download | lua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.tar.gz lua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.tar.bz2 lua-9273fbd131eb0be7d4e7ca4f44345b41f8a557cf.zip | |
no more 'luaL_get/setfield' (replaced by more direct luaL_findtable)
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 19 |
1 files changed, 12 insertions, 7 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.147 2005/08/25 15:39:16 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.148 2005/08/25 19:55:38 roberto Exp roberto $ |
| 3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -71,14 +71,19 @@ static int report (lua_State *L, int status) { | |||
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | static int traceback (lua_State *L) { | 73 | static int traceback (lua_State *L) { |
| 74 | luaL_getfield(L, LUA_GLOBALSINDEX, "debug.traceback"); | 74 | lua_getfield(L, LUA_GLOBALSINDEX, "debug"); |
| 75 | if (!lua_isfunction(L, -1)) | 75 | if (!lua_istable(L, -1)) { |
| 76 | lua_pop(L, 1); | 76 | lua_pop(L, 1); |
| 77 | else { | 77 | return 1; |
| 78 | lua_pushvalue(L, 1); /* pass error message */ | ||
| 79 | lua_pushinteger(L, 2); /* skip this function and traceback */ | ||
| 80 | lua_call(L, 2, 1); /* call debug.traceback */ | ||
| 81 | } | 78 | } |
| 79 | lua_getfield(L, -1, "traceback"); | ||
| 80 | if (!lua_isfunction(L, -1)) { | ||
| 81 | lua_pop(L, 2); | ||
| 82 | return 1; | ||
| 83 | } | ||
| 84 | lua_pushvalue(L, 1); /* pass error message */ | ||
| 85 | lua_pushinteger(L, 2); /* skip this function and traceback */ | ||
| 86 | lua_call(L, 2, 1); /* call debug.traceback */ | ||
| 82 | return 1; | 87 | return 1; |
| 83 | } | 88 | } |
| 84 | 89 | ||
