MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / get_weak_table

Function get_weak_table

ogsr_engine/Luabind/src/weak_ref.cpp:60–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 };
59
60 void get_weak_table(lua_State* L)
61 {
62 lua_pushliteral(L, "__luabind_weak_refs");
63 lua_gettable(L, LUA_REGISTRYINDEX);
64
65 if (lua_isnil(L, -1))
66 {
67 lua_pop(L, 1);
68 lua_newtable(L);
69 // metatable
70 lua_newtable(L);
71 lua_pushliteral(L, "__mode");
72 lua_pushliteral(L, "v");
73 lua_rawset(L, -3);
74 // set metatable
75 lua_setmetatable(L, -2);
76 lua_pushnumber(L, 0);
77 lua_rawseti(L, -2, freelist_ref);
78 lua_pushnumber(L, 2);
79 lua_rawseti(L, -2, count_ref);
80
81 lua_pushliteral(L, "__luabind_weak_refs");
82 lua_pushvalue(L, -2);
83 lua_settable(L, LUA_REGISTRYINDEX);
84 }
85 }
86
87 } // namespace unnamed
88

Callers 3

implMethod · 0.85
~implMethod · 0.85
getMethod · 0.85

Calls 7

lua_gettableFunction · 0.50
lua_rawsetFunction · 0.50
lua_setmetatableFunction · 0.50
lua_pushnumberFunction · 0.50
lua_rawsetiFunction · 0.50
lua_pushvalueFunction · 0.50
lua_settableFunction · 0.50

Tested by

no test coverage detected