diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:58:11 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:58:11 -0200 |
commit | af59848219abcab589ac174c829102ed8a2adc8d (patch) | |
tree | 3deabe4b29f255013ae2fe83553ffa48f578d90d /lvm.c | |
parent | 46347d768e571ba9b36581c36d11d2de1dee2cfb (diff) | |
download | lua-af59848219abcab589ac174c829102ed8a2adc8d.tar.gz lua-af59848219abcab589ac174c829102ed8a2adc8d.tar.bz2 lua-af59848219abcab589ac174c829102ed8a2adc8d.zip |
tables of globals accessible through pseudo-index in C API
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.195 2001/10/02 16:45:03 roberto Exp $ | 2 | ** $Id: lvm.c,v 1.196 2001/10/25 19:14:14 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -176,7 +176,7 @@ void luaV_settable (lua_State *L, StkId t, TObject *key, StkId val) { | |||
176 | 176 | ||
177 | 177 | ||
178 | void luaV_getglobal (lua_State *L, TString *name, StkId res) { | 178 | void luaV_getglobal (lua_State *L, TString *name, StkId res) { |
179 | const TObject *value = luaH_getstr(L->gt, name); | 179 | const TObject *value = luaH_getstr(hvalue(&L->gt), name); |
180 | Closure *tm; | 180 | Closure *tm; |
181 | if (!HAS_TM_GETGLOBAL(L, ttype(value)) || /* is there a tag method? */ | 181 | if (!HAS_TM_GETGLOBAL(L, ttype(value)) || /* is there a tag method? */ |
182 | (tm = luaT_gettmbyObj(G(L), value, TM_GETGLOBAL)) == NULL) { | 182 | (tm = luaT_gettmbyObj(G(L), value, TM_GETGLOBAL)) == NULL) { |
@@ -188,12 +188,12 @@ void luaV_getglobal (lua_State *L, TString *name, StkId res) { | |||
188 | 188 | ||
189 | 189 | ||
190 | void luaV_setglobal (lua_State *L, TString *name, StkId val) { | 190 | void luaV_setglobal (lua_State *L, TString *name, StkId val) { |
191 | const TObject *oldvalue = luaH_getstr(L->gt, name); | 191 | const TObject *oldvalue = luaH_getstr(hvalue(&L->gt), name); |
192 | Closure *tm; | 192 | Closure *tm; |
193 | if (!HAS_TM_SETGLOBAL(L, ttype(oldvalue)) || /* no tag methods? */ | 193 | if (!HAS_TM_SETGLOBAL(L, ttype(oldvalue)) || /* no tag methods? */ |
194 | (tm = luaT_gettmbyObj(G(L), oldvalue, TM_SETGLOBAL)) == NULL) { | 194 | (tm = luaT_gettmbyObj(G(L), oldvalue, TM_SETGLOBAL)) == NULL) { |
195 | if (oldvalue == &luaO_nilobject) | 195 | if (oldvalue == &luaO_nilobject) |
196 | luaH_setstr(L, L->gt, name, val); /* raw set */ | 196 | luaH_setstr(L, hvalue(&L->gt), name, val); /* raw set */ |
197 | else | 197 | else |
198 | settableval(oldvalue, val); /* warning: tricky optimization! */ | 198 | settableval(oldvalue, val); /* warning: tricky optimization! */ |
199 | } | 199 | } |