| 39 | |
| 40 | |
| 41 | void get_weak_table(lua_State* L) |
| 42 | { |
| 43 | lua_rawgetp(L, LUA_REGISTRYINDEX, &weak_table_tag); |
| 44 | |
| 45 | if (lua_isnil(L, -1)) |
| 46 | { |
| 47 | lua_pop(L, 1); |
| 48 | lua_newtable(L); |
| 49 | // metatable |
| 50 | lua_createtable(L, 0, 1); // One non-sequence entry for __mode. |
| 51 | lua_pushliteral(L, "__mode"); |
| 52 | lua_pushliteral(L, "v"); |
| 53 | lua_rawset(L, -3); |
| 54 | // set metatable |
| 55 | lua_setmetatable(L, -2); |
| 56 | |
| 57 | lua_pushvalue(L, -1); |
| 58 | lua_rawsetp(L, LUA_REGISTRYINDEX, &weak_table_tag); |
| 59 | |
| 60 | } |
| 61 | |
| 62 | } |
| 63 | |
| 64 | void get_impl_table(lua_State* L) |
| 65 | { |
no test coverage detected