diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-08 17:49:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-08 17:49:05 -0300 |
| commit | bad6365540ad9e17e51137a6797ff196d6b8d2a1 (patch) | |
| tree | 8d16d51f0c4167f59a879751660742ff28bf011f | |
| parent | 91f34fb05caa9590cd19a986e865a93361b1c398 (diff) | |
| download | lua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.tar.gz lua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.tar.bz2 lua-bad6365540ad9e17e51137a6797ff196d6b8d2a1.zip | |
details
| -rw-r--r-- | lapi.c | 21 | ||||
| -rw-r--r-- | lapi.h | 3 | ||||
| -rw-r--r-- | ldebug.c | 4 |
3 files changed, 12 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.78 2000/04/17 19:23:12 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.79 2000/05/08 19:32:53 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -44,13 +44,6 @@ lua_Object luaA_putluaObject (lua_State *L, const TObject *o) { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | lua_Object luaA_putObjectOnTop (lua_State *L) { | ||
| 48 | luaD_openstack(L, L->Cstack.base); | ||
| 49 | *L->Cstack.base++ = *(--L->top); | ||
| 50 | return L->Cstack.base-1; | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | static void top2LC (lua_State *L, int n) { | 47 | static void top2LC (lua_State *L, int n) { |
| 55 | /* Put the `n' elements on the top as the Lua2C contents */ | 48 | /* Put the `n' elements on the top as the Lua2C contents */ |
| 56 | L->Cstack.base = L->top; /* new base */ | 49 | L->Cstack.base = L->top; /* new base */ |
| @@ -61,7 +54,11 @@ static void top2LC (lua_State *L, int n) { | |||
| 61 | 54 | ||
| 62 | lua_Object lua_pop (lua_State *L) { | 55 | lua_Object lua_pop (lua_State *L) { |
| 63 | luaA_checkCargs(L, 1); | 56 | luaA_checkCargs(L, 1); |
| 64 | return luaA_putObjectOnTop(L); | 57 | if (L->Cstack.base != L->top-1) { |
| 58 | luaD_openstack(L, L->Cstack.base); | ||
| 59 | *L->Cstack.base = *(--L->top); | ||
| 60 | } | ||
| 61 | return L->Cstack.base++; | ||
| 65 | } | 62 | } |
| 66 | 63 | ||
| 67 | 64 | ||
| @@ -112,14 +109,14 @@ lua_Object lua_settagmethod (lua_State *L, int tag, const char *event) { | |||
| 112 | if ((ttype(method) != TAG_NIL) && (*lua_type(L, method) != 'f')) | 109 | if ((ttype(method) != TAG_NIL) && (*lua_type(L, method) != 'f')) |
| 113 | lua_error(L, "Lua API error - tag method must be a function or nil"); | 110 | lua_error(L, "Lua API error - tag method must be a function or nil"); |
| 114 | luaT_settagmethod(L, tag, event, method); | 111 | luaT_settagmethod(L, tag, event, method); |
| 115 | return luaA_putObjectOnTop(L); | 112 | return lua_pop(L); |
| 116 | } | 113 | } |
| 117 | 114 | ||
| 118 | 115 | ||
| 119 | lua_Object lua_gettable (lua_State *L) { | 116 | lua_Object lua_gettable (lua_State *L) { |
| 120 | luaA_checkCargs(L, 2); | 117 | luaA_checkCargs(L, 2); |
| 121 | luaV_gettable(L, L->top--); | 118 | luaV_gettable(L, L->top--); |
| 122 | return luaA_putObjectOnTop(L); | 119 | return lua_pop(L); |
| 123 | } | 120 | } |
| 124 | 121 | ||
| 125 | 122 | ||
| @@ -163,7 +160,7 @@ lua_Object lua_createtable (lua_State *L) { | |||
| 163 | 160 | ||
| 164 | lua_Object lua_getglobal (lua_State *L, const char *name) { | 161 | lua_Object lua_getglobal (lua_State *L, const char *name) { |
| 165 | luaV_getglobal(L, luaS_new(L, name), L->top++); | 162 | luaV_getglobal(L, luaS_new(L, name), L->top++); |
| 166 | return luaA_putObjectOnTop(L); | 163 | return lua_pop(L); |
| 167 | } | 164 | } |
| 168 | 165 | ||
| 169 | 166 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.h,v 1.16 2000/03/29 20:19:20 roberto Exp roberto $ | 2 | ** $Id: lapi.h,v 1.17 2000/05/08 19:32:53 roberto Exp roberto $ |
| 3 | ** Auxiliary functions from Lua API | 3 | ** Auxiliary functions from Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -15,6 +15,5 @@ void luaA_checkCargs (lua_State *L, int nargs); | |||
| 15 | void luaA_pushobject (lua_State *L, const TObject *o); | 15 | void luaA_pushobject (lua_State *L, const TObject *o); |
| 16 | int luaA_next (lua_State *L, const Hash *t, int i); | 16 | int luaA_next (lua_State *L, const Hash *t, int i); |
| 17 | lua_Object luaA_putluaObject (lua_State *L, const TObject *o); | 17 | lua_Object luaA_putluaObject (lua_State *L, const TObject *o); |
| 18 | lua_Object luaA_putObjectOnTop (lua_State *L); | ||
| 19 | 18 | ||
| 20 | #endif | 19 | #endif |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.16 2000/03/30 20:55:50 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.17 2000/05/08 19:32:53 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -197,7 +197,7 @@ int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { | |||
| 197 | case 'f': | 197 | case 'f': |
| 198 | setnormalized(L->top, func); | 198 | setnormalized(L->top, func); |
| 199 | incr_top; | 199 | incr_top; |
| 200 | ar->func = luaA_putObjectOnTop(L); | 200 | ar->func = lua_pop(L); |
| 201 | break; | 201 | break; |
| 202 | default: return 0; /* invalid option */ | 202 | default: return 0; /* invalid option */ |
| 203 | } | 203 | } |
