MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / shared_init

Method shared_init

Source/Misc/luabind/src/class_rep.cpp:59–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59void luabind::detail::class_rep::shared_init(lua_State * L)
60{
61 lua_newtable(L);
62 handle(L, -1).swap(m_table);
63 lua_newtable(L);
64 handle(L, -1).swap(m_default_table);
65 lua_pop(L, 2);
66
67 class_registry* r = class_registry::get_registry(L);
68 // the following line should be equivalent whether or not this is a cpp class
69 assert((r->cpp_class() != LUA_NOREF) && "you must call luabind::open()");
70
71 lua_rawgeti(L, LUA_REGISTRYINDEX, (m_class_type == cpp_class) ? r->cpp_class() : r->lua_class());
72 lua_setmetatable(L, -2);
73
74 handle(L, -1).swap(m_self_ref);
75
76 m_instance_metatable = (m_class_type == cpp_class) ? r->cpp_instance() : r->lua_instance();
77
78 lua_rawgetp(L, LUA_REGISTRYINDEX, &cast_graph_tag);
79 m_casts = static_cast<cast_graph*>(lua_touserdata(L, -1));
80 lua_pop(L, 1);
81
82 lua_rawgetp(L, LUA_REGISTRYINDEX, &classid_map_tag);
83 m_classes = static_cast<class_id_map*>(lua_touserdata(L, -1));
84 lua_pop(L, 1);
85
86}
87
88luabind::detail::class_rep::class_rep(lua_State* L, const char* name_)
89 : m_type(typeid(null_type))

Callers

nothing calls this directly

Calls 6

handleClass · 0.85
lua_rawgetiFunction · 0.85
lua_setmetatableFunction · 0.85
lua_rawgetpFunction · 0.85
lua_touserdataFunction · 0.85
swapMethod · 0.45

Tested by

no test coverage detected