@@ -126,15 +126,14 @@ prepared_lua_function_t::prepared_lua_function_t(lua_State *lua_state,
126
126
namespace {
127
127
128
128
void push_osm_object_to_lua_stack (lua_State *lua_state,
129
- osmium::OSMObject const &object,
130
- bool with_attributes)
129
+ osmium::OSMObject const &object)
131
130
{
132
131
assert (lua_state);
133
132
134
133
/* *
135
- * Table will always have at least 3 fields (id, type, tags). And 5 more if
136
- * with_attributes is true (version, timestamp, changeset, uid, user). For
137
- * ways there are 2 more (is_closed, nodes), for relations 1 more (members).
134
+ * Table will always have at least 8 fields (id, type, tags, version,
135
+ * timestamp, changeset, uid, user). For ways there are 2 more (is_closed,
136
+ * nodes), for relations 1 more (members).
138
137
*/
139
138
constexpr int const max_table_size = 10 ;
140
139
@@ -145,23 +144,21 @@ void push_osm_object_to_lua_stack(lua_State *lua_state,
145
144
luaX_add_table_str (lua_state, " type" ,
146
145
osmium::item_type_to_name (object.type ()));
147
146
148
- if (with_attributes) {
149
- if (object.version () != 0U ) {
150
- luaX_add_table_int (lua_state, " version" , object.version ());
151
- }
152
- if (object.timestamp ().valid ()) {
153
- luaX_add_table_int (lua_state, " timestamp" ,
154
- object.timestamp ().seconds_since_epoch ());
155
- }
156
- if (object.changeset () != 0U ) {
157
- luaX_add_table_int (lua_state, " changeset" , object.changeset ());
158
- }
159
- if (object.uid () != 0U ) {
160
- luaX_add_table_int (lua_state, " uid" , object.uid ());
161
- }
162
- if (object.user ()[0 ] != ' \0 ' ) {
163
- luaX_add_table_str (lua_state, " user" , object.user ());
164
- }
147
+ if (object.version () != 0U ) {
148
+ luaX_add_table_int (lua_state, " version" , object.version ());
149
+ }
150
+ if (object.timestamp ().valid ()) {
151
+ luaX_add_table_int (lua_state, " timestamp" ,
152
+ object.timestamp ().seconds_since_epoch ());
153
+ }
154
+ if (object.changeset () != 0U ) {
155
+ luaX_add_table_int (lua_state, " changeset" , object.changeset ());
156
+ }
157
+ if (object.uid () != 0U ) {
158
+ luaX_add_table_int (lua_state, " uid" , object.uid ());
159
+ }
160
+ if (object.user ()[0 ] != ' \0 ' ) {
161
+ luaX_add_table_str (lua_state, " user" , object.user ());
165
162
}
166
163
167
164
if (object.type () == osmium::item_type::way) {
@@ -692,8 +689,7 @@ int output_flex_t::table_insert()
692
689
lua_pushboolean (lua_state (), false );
693
690
lua_pushstring (lua_state (), " null value in not null column." );
694
691
lua_pushstring (lua_state (), e.column ().name ().c_str ());
695
- push_osm_object_to_lua_stack (lua_state (), object,
696
- get_options ()->extra_attributes );
692
+ push_osm_object_to_lua_stack (lua_state (), object);
697
693
table_connection.increment_not_null_error_counter ();
698
694
return 4 ;
699
695
}
@@ -820,9 +816,7 @@ void output_flex_t::call_lua_function(prepared_lua_function_t func,
820
816
m_calling_context = func.context ();
821
817
822
818
lua_pushvalue (lua_state (), func.index ()); // the function to call
823
- push_osm_object_to_lua_stack (
824
- lua_state (), object,
825
- get_options ()->extra_attributes ); // the single argument
819
+ push_osm_object_to_lua_stack (lua_state (), object); // the single argument
826
820
827
821
luaX_set_context (lua_state (), this );
828
822
if (luaX_pcall (lua_state (), 1 , func.nresults ())) {
0 commit comments