diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-10-30 14:25:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-10-30 14:25:59 -0300 |
commit | 43c8e5bded052801f54a7439d18933b83570eb82 (patch) | |
tree | 97f6d1e020110e14c798537c7bbb1f90feed4044 /lstate.c | |
parent | b8b709b6d40c5c18d9b8ef33bb50afc55f048ab8 (diff) | |
download | lua-43c8e5bded052801f54a7439d18933b83570eb82.tar.gz lua-43c8e5bded052801f54a7439d18933b83570eb82.tar.bz2 lua-43c8e5bded052801f54a7439d18933b83570eb82.zip |
Full abstraction for representation of array values
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -215,13 +215,16 @@ static void freestack (lua_State *L) { | |||
215 | */ | 215 | */ |
216 | static void init_registry (lua_State *L, global_State *g) { | 216 | static void init_registry (lua_State *L, global_State *g) { |
217 | /* create registry */ | 217 | /* create registry */ |
218 | TValue aux; | ||
218 | Table *registry = luaH_new(L); | 219 | Table *registry = luaH_new(L); |
219 | sethvalue(L, &g->l_registry, registry); | 220 | sethvalue(L, &g->l_registry, registry); |
220 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); | 221 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); |
221 | /* registry[LUA_RIDX_MAINTHREAD] = L */ | 222 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
222 | setthvalue(L, ®istry->array[LUA_RIDX_MAINTHREAD - 1], L); | 223 | setthvalue(L, &aux, L); |
224 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &aux); | ||
223 | /* registry[LUA_RIDX_GLOBALS] = new table (table of globals) */ | 225 | /* registry[LUA_RIDX_GLOBALS] = new table (table of globals) */ |
224 | sethvalue(L, ®istry->array[LUA_RIDX_GLOBALS - 1], luaH_new(L)); | 226 | sethvalue(L, &aux, luaH_new(L)); |
227 | luaH_setint(L, registry, LUA_RIDX_GLOBALS, &aux); | ||
225 | } | 228 | } |
226 | 229 | ||
227 | 230 | ||