tagtransform::tagtransform(const options_t *options_) : options(options_), transform_method(options_->tag_transform_script) #ifdef HAVE_LUA , L(NULL) , m_node_func( options->tag_transform_node_func. get_value_or("filter_tags_node")) , m_way_func( options->tag_transform_way_func. get_value_or("filter_tags_way")) , m_rel_func( options->tag_transform_rel_func. get_value_or("filter_basic_tags_rel")) , m_rel_mem_func(options->tag_transform_rel_mem_func.get_value_or("filter_tags_relation_member")) #endif /* HAVE_LUA */ { if (transform_method) { fprintf(stderr, "Using lua based tag processing pipeline with script %s\n", options->tag_transform_script->c_str()); #ifdef HAVE_LUA L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L, options->tag_transform_script->c_str()); check_lua_function_exists(m_node_func); check_lua_function_exists(m_way_func); check_lua_function_exists(m_rel_func); check_lua_function_exists(m_rel_mem_func); #else throw std::runtime_error("Error: Could not init lua tag transform, as lua support was not compiled into this version"); #endif } else { fprintf(stderr, "Using built-in tag processing pipeline\n"); } }
lua_tagtransform_t::lua_tagtransform_t(options_t const *options) : L(luaL_newstate()), m_node_func(options->tag_transform_node_func.get_value_or( "filter_tags_node")), m_way_func(options->tag_transform_way_func.get_value_or("filter_tags_way")), m_rel_func( options->tag_transform_rel_func.get_value_or("filter_basic_tags_rel")), m_rel_mem_func(options->tag_transform_rel_mem_func.get_value_or( "filter_tags_relation_member")), m_extra_attributes(options->extra_attributes) { luaL_openlibs(L); luaL_dofile(L, options->tag_transform_script->c_str()); check_lua_function_exists(m_node_func); check_lua_function_exists(m_way_func); check_lua_function_exists(m_rel_func); check_lua_function_exists(m_rel_mem_func); }