From 17e0c29d9b435392016b707309ed51409b0aea12 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 15 Jan 2024 11:31:49 -0300 Subject: Clear interface between references and predefines The reference system has a defined way to add initial values to the table where it operates. --- lstate.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index 78146bdb..9a61cd6d 100644 --- a/lstate.c +++ b/lstate.c @@ -189,6 +189,9 @@ static void init_registry (lua_State *L, global_State *g) { Table *registry = luaH_new(L); sethvalue(L, &g->l_registry, registry); luaH_resize(L, registry, LUA_RIDX_LAST, 0); + /* registry[1] = false */ + setbfvalue(&aux); + luaH_setint(L, registry, 1, &aux); /* registry[LUA_RIDX_MAINTHREAD] = L */ setthvalue(L, &aux, L); luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &aux); -- cgit v1.2.3-55-g6feb