** Create registry table and its predefined values */
| 160 | ** Create registry table and its predefined values |
| 161 | */ |
| 162 | static void init_registry (lua_State *L, global_State *g) { |
| 163 | TValue mt; |
| 164 | /* create registry */ |
| 165 | Table *registry = luaH_new(L); |
| 166 | sethvalue(L, &g->l_registry, registry); |
| 167 | luaH_resize(L, registry, LUA_RIDX_LAST, 0); |
| 168 | /* registry[LUA_RIDX_MAINTHREAD] = L */ |
| 169 | setthvalue(L, &mt, L); |
| 170 | luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt); |
| 171 | /* registry[LUA_RIDX_GLOBALS] = table of globals */ |
| 172 | sethvalue(L, &mt, luaH_new(L)); |
| 173 | luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt); |
| 174 | } |
| 175 | |
| 176 | |
| 177 | /* |
no test coverage detected