MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / operator[]

Method operator[]

ogsr_engine/Luabind/src/scope.cpp:118–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 }
117
118 void module_::operator[](scope&& s)
119 {
120 if (m_name)
121 {
122 lua_pushstring(m_state, m_name);
123 lua_gettable(m_state, LUA_GLOBALSINDEX);
124
125 if (!lua_istable(m_state, -1))
126 {
127 lua_pop(m_state, 1);
128
129 lua_newtable(m_state);
130 lua_pushstring(m_state, m_name);
131 lua_pushvalue(m_state, -2);
132 lua_settable(m_state, LUA_GLOBALSINDEX);
133 }
134 }
135 else
136 {
137 lua_pushvalue(m_state, LUA_GLOBALSINDEX);
138 }
139
140 lua_pop_stack guard(m_state);
141
142 if (::luabind::get_pregister_callback())
143 ::luabind::get_pregister_callback() (m_state,true);
144
145 s.register_(m_state);
146
147 if (::luabind::get_pregister_callback())
148 ::luabind::get_pregister_callback() (m_state,false);
149 }
150
151 struct namespace_::registration_ : detail::registration
152 {

Callers

nothing calls this directly

Calls 6

get_pregister_callbackFunction · 0.85
lua_pushstringFunction · 0.50
lua_gettableFunction · 0.50
lua_pushvalueFunction · 0.50
lua_settableFunction · 0.50
register_Method · 0.45

Tested by

no test coverage detected