@@ -158,39 +158,41 @@ void push_osm_object_to_lua_stack(lua_State *lua_state,
158158 luaX_add_table_str (lua_state, " user" , object.user ());
159159 }
160160
161- if (object.type () == osmium::item_type::way) {
162- auto const &way = static_cast <osmium::Way const &>(object);
163- luaX_add_table_bool (lua_state, " is_closed" ,
164- !way.nodes ().empty () && way.is_closed ());
165- luaX_add_table_array (lua_state, " nodes" , way.nodes (),
166- [&](osmium::NodeRef const &wn) {
167- lua_pushinteger (lua_state, wn.ref ());
168- });
169- } else if (object.type () == osmium::item_type::relation) {
170- auto const &relation = static_cast <osmium::Relation const &>(object);
171- luaX_add_table_array (
172- lua_state, " members" , relation.members (),
173- [&](osmium::RelationMember const &member) {
174- lua_createtable (lua_state, 0 , 3 );
175- std::array<char , 2 > tmp{" x" };
176- tmp[0 ] = osmium::item_type_to_char (member.type ());
177- luaX_add_table_str (lua_state, " type" , tmp.data ());
178- luaX_add_table_int (lua_state, " ref" , member.ref ());
179- luaX_add_table_str (lua_state, " role" , member.role ());
180- });
181- }
182-
183- lua_pushliteral (lua_state, " tags" );
184- lua_createtable (lua_state, 0 , (int )object.tags ().size ());
185- for (auto const &tag : object.tags ()) {
186- luaX_add_table_str (lua_state, tag.key (), tag.value ());
187- }
188- lua_rawset (lua_state, -3 );
189-
190- // Set the metatable of this object
191- lua_pushstring (lua_state, OSM2PGSQL_OSMOBJECT_CLASS);
192- lua_gettable (lua_state, LUA_REGISTRYINDEX);
193- lua_setmetatable (lua_state, -2 );
161+ if (!object.deleted ()) {
162+ if (object.type () == osmium::item_type::way) {
163+ auto const &way = static_cast <osmium::Way const &>(object);
164+ luaX_add_table_bool (lua_state, " is_closed" ,
165+ !way.nodes ().empty () && way.is_closed ());
166+ luaX_add_table_array (lua_state, " nodes" , way.nodes (),
167+ [&](osmium::NodeRef const &wn) {
168+ lua_pushinteger (lua_state, wn.ref ());
169+ });
170+ } else if (object.type () == osmium::item_type::relation) {
171+ auto const &relation = static_cast <osmium::Relation const &>(object);
172+ luaX_add_table_array (
173+ lua_state, " members" , relation.members (),
174+ [&](osmium::RelationMember const &member) {
175+ lua_createtable (lua_state, 0 , 3 );
176+ std::array<char , 2 > tmp{" x" };
177+ tmp[0 ] = osmium::item_type_to_char (member.type ());
178+ luaX_add_table_str (lua_state, " type" , tmp.data ());
179+ luaX_add_table_int (lua_state, " ref" , member.ref ());
180+ luaX_add_table_str (lua_state, " role" , member.role ());
181+ });
182+ }
183+
184+ lua_pushliteral (lua_state, " tags" );
185+ lua_createtable (lua_state, 0 , (int )object.tags ().size ());
186+ for (auto const &tag : object.tags ()) {
187+ luaX_add_table_str (lua_state, tag.key (), tag.value ());
188+ }
189+ lua_rawset (lua_state, -3 );
190+
191+ // Set the metatable of this object
192+ lua_pushstring (lua_state, OSM2PGSQL_OSMOBJECT_CLASS);
193+ lua_gettable (lua_state, LUA_REGISTRYINDEX);
194+ lua_setmetatable (lua_state, -2 );
195+ }
194196}
195197
196198/* *
0 commit comments