aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-10-30 14:25:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-10-30 14:25:59 -0300
commit43c8e5bded052801f54a7439d18933b83570eb82 (patch)
tree97f6d1e020110e14c798537c7bbb1f90feed4044 /lstate.c
parentb8b709b6d40c5c18d9b8ef33bb50afc55f048ab8 (diff)
downloadlua-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.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lstate.c b/lstate.c
index 1e925e5a..d10cd88c 100644
--- a/lstate.c
+++ b/lstate.c
@@ -215,13 +215,16 @@ static void freestack (lua_State *L) {
215*/ 215*/
216static void init_registry (lua_State *L, global_State *g) { 216static 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, &registry->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, &registry->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