@@ -534,6 +534,7 @@ void output_flex_t::setup_id_columns(flex_table_t *table)
534534
535535 std::string const type{
536536 luaX_get_table_string (lua_state (), " type" , -1 , " The ids field" )};
537+ lua_pop (lua_state (), 1 ); // "type"
537538
538539 if (type == " node" ) {
539540 table->set_id_type (osmium::item_type::node);
@@ -545,7 +546,7 @@ void output_flex_t::setup_id_columns(flex_table_t *table)
545546 table->set_id_type (osmium::item_type::area);
546547 } else if (type == " any" ) {
547548 table->set_id_type (osmium::item_type::undefined);
548- lua_getfield (lua_state (), -2 , " type_column" );
549+ lua_getfield (lua_state (), -1 , " type_column" );
549550 if (lua_isstring (lua_state (), -1 )) {
550551 std::string const column_name =
551552 lua_tolstring (lua_state (), -1 , nullptr );
@@ -555,18 +556,19 @@ void output_flex_t::setup_id_columns(flex_table_t *table)
555556 } else if (!lua_isnil (lua_state (), -1 )) {
556557 throw std::runtime_error{" type_column must be a string or nil." };
557558 }
558- lua_pop (lua_state (), 1 ); // type_column
559+ lua_pop (lua_state (), 1 ); // " type_column"
559560 } else {
560561 throw fmt_error (" Unknown ids type: {}." , type);
561562 }
562563
563564 std::string const name =
564- luaX_get_table_string (lua_state (), " id_column" , -2 , " The ids field" );
565+ luaX_get_table_string (lua_state (), " id_column" , -1 , " The ids field" );
566+ lua_pop (lua_state (), 1 ); // "id_column"
565567 check_identifier (name, " column names" );
566568
567569 auto &column = table->add_column (name, " id_num" , " " );
568570 column.set_not_null ();
569- lua_pop (lua_state (), 3 ); // id_column, type, ids
571+ lua_pop (lua_state (), 1 ); // " ids"
570572}
571573
572574void output_flex_t::setup_flex_table_columns (flex_table_t *table)
0 commit comments