| 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 | { |
nothing calls this directly
no test coverage detected